Auto variable with sizeof == 0

mouse at mcgill-vision.UUCP mouse at mcgill-vision.UUCP
Wed Feb 11 16:36:04 AEST 1987


In article <409 at mipos3.UUCP>, pinkas at mipos3.UUCP (Israel Pinkas) writes:
> In article <5258 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
>> In article <4114 at brl-adm.ARPA> escott%deis.uci.edu at icsg.uci.edu (Scott Menter) writes:
>>> ... is there any reason why you should be able to declare an array
>>> with zero elements as an automatic variable?

Uniformity.  Note that this, ie [0], is not the same as [].

>> Why not?  [...] no members of that array are accessible:  Valid
>> subscripts are in the range [0..0).

It doesn't even occupy any storage (at least it does, zero bytes of
it), so sure, why not?

> Wrong.  There are no valid subscripts to the array.

That is what Chris meant (I'm sure).  Mathematicians use square
brackets to denote a closed interval end and parentheses to denote an
open end, so that [1..10) would indicate those x for which 1<=x<10.
This is arguably inconsistent when both ends are the same value, but I,
at least, found his meaning perfectly clear anyway.

(Generally, if you disagree with Chris about a point of fact (as
opposed to opinion), check your beliefs, assumptions, and understanding
of his posting very carefully; he's usually right.)

					der Mouse

USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse
     think!mosart!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
ARPAnet: think!mosart!mcgill-vision!mouse at harvard.harvard.edu



More information about the Comp.lang.c mailing list