home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!snorkelwacker.mit.edu!bloom-picayune.mit.edu!news
- From: scs@adam.mit.edu (Steve Summit)
- Subject: Re: Variable length records
- Message-ID: <1992Jul30.203126.24344@athena.mit.edu>
- Sender: news@athena.mit.edu (News system)
- Nntp-Posting-Host: adam.mit.edu
- Organization: none, at the moment
- References: <1992Jul29.160618.27224@klaava.Helsinki.FI> <156nvcINNecv@early-bird.think.com> <1992Jul30.002228.5973@klaava.Helsinki.FI>
- Date: Thu, 30 Jul 1992 20:31:26 GMT
- Lines: 39
-
- In article <1992Jul30.002228.5973@klaava.Helsinki.FI>, wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
- > On the other hand, perhaps this thread is getting a bit too long: if you
- > want strict conformance and portability, use a separately allocated
- > array, if you prefer a little bit of convenience, use the others. And
- > the '[1]' version (see earlier posts) may even have both qualities (I'm
- > not quite certain).
-
- It does. As the comp.lang.c frequently-asked questions (FAQ)
- list says,
-
- This technique is popular, although Dennis Ritchie has called it
- "unwarranted chumminess with the compiler." The ANSI C standard
- allows it only implicitly. It seems to be portable to all known
- implementations. (Compilers which check array bounds carefully
- might issue warnings.)
-
- References: ANSI Rationale Sec. 3.5.4.2 pp. 54-5.
-
- I wish it were possible to state unambiguously that the usage is
- strictly conforming, and to point at a single statement in the
- Standard to support the claim. I know of at least one satisfying
- "proof" (due to Mark Brader), but it's a bit involved. (As the
- Jargon file says, "A language lawyer is distinguished by the
- ability to show you the five sentences scattered through a
- 200-plus-page manual that together imply the answer to your
- question `if only you had thought to look there'.")
-
- Without question, the "chummy" idioms are so widespread that most
- compilers would probably strive to support them even if they were
- not quite Standard.
-
- Actually, if you're willing to trust the Rationale (which is, of
- course, "not part of American National Standard X3.159-1989," the
- section referenced in the above FAQ list entry is quite direct in
- stating that such variable-size structures are permissible, as
- long as the declared array size is greater than 0.
-
- Steve Summit
- scs@adam.mit.edu
-