Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c > #1626

Second draft, "Safe arrays and pointers for C"

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From John Nagle <nagle@animats.com>
Newsgroups comp.std.c
Subject Second draft, "Safe arrays and pointers for C"
Date Thu, 30 Aug 2012 12:48:15 -0700
Organization A noiseless patient Spider
Lines 49
Message-ID <503FC37F.8050701@animats.com> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
Injection-Info mx04.eternal-september.org; posting-host="be1bb0721696fa49da97c8fb91891936"; logging-data="23813"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rH0AhMozl9jPoXeW+5+1W"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1
Cancel-Lock sha1:8HPqoIKCJpgCLHBEKpAEQSNAMbg=
Xref csiph.com comp.std.c:1626

Show key headers only | View raw


In response to all the comments above under "Initial draft proposal:
"Safe arrays and pointers for C", I have a new revision for
discussion.

http://www.animats.com/papers/languages/safearraysforc41.pdf

Major changes:

- It's made clearer that non-strict code can call strict code
  and vice versa, and that function prototypes can be written
  in strict style and called from both strict code (with
  checking) and non-strict code (without checking).  Thus,
  there's a clear migration path to strict code - start
  with the low level libraries and work up.

- The proposed generic functions have been removed. Instead,
  it is proposed to import the "decltype" feature from C++.
  This allows writing the generic functions needed for
  making "malloc" allocation type-safe as C macros.

- The proposal is written relative to N1570.

- Run time subscript and size checking action is
  as specified in N1570, Annex K.

- The relationship with C variable length arrays is discussed.

- The problem of forward-referenced formal parameters
  (where the declaration of an array is followed by
  a parameter with its size) is addressed, using the
  GCC forward declaration extension.

- The restrictions on array length expressions needed
  for consistency between call and definition are made
  explicit.

- Implications for this feature in C++ are briefly discussed,
  the intent being to avoid divergence from C++.  The issue of
  how C++ style "name mangling" and variable length array
  parameters could coexist is addressed.  This
  proposal is now potentially compatible with C++ as
  well as C.

Please comment, as before.  I would particularly like to hear
from people involved with GCC as to how difficult a job it
would be to implement this in GCC as an extension.  Then
we could get some experience with this approach.

				John Nagle

Back to comp.std.c | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Second draft, "Safe arrays and pointers for C" John Nagle <nagle@animats.com> - 2012-08-30 12:48 -0700
  Re: Second draft, "Safe arrays and pointers for C" pacman@kosh.dhis.org (Alan Curry) - 2012-08-31 22:17 +0000
    Re: Second draft, "Safe arrays and pointers for C" John Nagle <nagle@animats.com> - 2012-08-31 17:26 -0700
      Re: Second draft, "Safe arrays and pointers for C" Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-09-02 22:20 +0200
        Re: Second draft, "Safe arrays and pointers for C" BGB <cr88192@hotmail.com> - 2012-09-03 10:55 -0500
          Re: Second draft, "Safe arrays and pointers for C" Ike Naar <ike@iceland.freeshell.org> - 2012-09-03 16:39 +0000
            Re: Second draft, "Safe arrays and pointers for C" BGB <cr88192@hotmail.com> - 2012-09-03 13:18 -0500
  Re: Second draft, "Safe arrays and pointers for C" Jens Gustedt <jens.gustedt@loria.fr> - 2012-09-02 10:52 +0200
  Re: Second draft, "Safe arrays and pointers for C" Per <per.mathisen@gmail.com> - 2012-09-28 06:49 -0700
    Re: Second draft, "Safe arrays and pointers for C" John Nagle <nagle@animats.com> - 2012-09-28 11:36 -0700
      Re: Second draft, "Safe arrays and pointers for C" Per <per.mathisen@gmail.com> - 2012-10-01 09:38 -0700
        Re: Second draft, "Safe arrays and pointers for C" John Nagle <nagle@animats.com> - 2012-10-01 11:38 -0700
      Re: Second draft, "Safe arrays and pointers for C" Shao Miller <sha0.miller@gmail.com> - 2012-12-17 09:11 -0500
        Re: Second draft, "Safe arrays and pointers for C" Keith Thompson <kst-u@mib.org> - 2012-12-17 10:18 -0800
          Re: Second draft, "Safe arrays and pointers for C" Shao Miller <sha0.miller@gmail.com> - 2012-12-17 18:24 -0500
            Re: Second draft, "Safe arrays and pointers for C" Shao Miller <sha0.miller@gmail.com> - 2012-12-17 18:32 -0500
            Re: Second draft, "Safe arrays and pointers for C" Keith Thompson <kst-u@mib.org> - 2012-12-17 15:44 -0800

csiph-web