>>> 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 [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message