Date: Mon, 04 Mar 2002 11:04:11 -0700 From: Ian <freebsd@damnhippie.dyndns.org> To: freebsd-hackers <freebsd-hackers@freebsd.org> Subject: Re: A few questions about a few includes Message-ID: <B8A9052B.AB52%freebsd@damnhippie.dyndns.org> In-Reply-To: <20020304103250.GA63341@student.uu.se>
next in thread | previous in thread | raw e-mail | index | archive | help
>>> Zero length arrays >>> are undefined. >> >> Well, yes, but the quesiton is *why* they are undefined. >> They are undefined only because ANSI says that they are. >> But why did they say so? > > They didn't really. They just didn't say that zero-length arrays are > allowed. (This might be changed in C99, I am not sure.) > > The reason this was not allowed was probably because it was too > difficult to phrase the standard in such a manner that reasonable uses > were allowed, while still not requiring the compiler to handle the > unreasonable cases. Actually in the original standard, zero-length arrays aren't undefined, they're specifically prohibited. Two sections of the standard can be intrepreted as forbidding them... 6.1.2.5 describes an array as "...a continguously allocated non-empty set of objects...". 6.5.4.2 says "The expression delimited by [ and ] (which specifies the size of an array) shall be an integral constant expression that has a value greater than zero." I used to moderate the c_language conference on BIX back in the days when the original ANSI standard was being codified. We used to have endless arguments and discussions about things such as this and the rationale for them, but I don't remember any discussion of this particular issue. (But it was so long ago now it almost seems like another lifetime. I haven't thought about BIX in ages.) -- Ian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B8A9052B.AB52%freebsd>