A last word on arrays? Hah! (LONG)

VLD/VMB gwyn at BRL.ARPA
Sat Apr 19 18:06:10 AEST 1986


jmp_buf jb;

setjmp( jb );

Ok, how do you propose to implement setjmp()?


Allowing array names as lvalues might be worthwhile,
but trying to totally redefine C array behavior at
this point comes under the category of invention,
not standardization.

Contrary to your statements, it is currently correct
to state that in C, with the minor exception of
the operand of sizeof, the NAME of an array object
in an expression is equivalent to a pointer to the
first element of the array.  This holds for
multidimensional arrays too, which is why foo[i]
means what it does for foo declared "type foo[M][N]".
C arrays are certainly not defined as cleanly as most
other elements of the language, but cleaning them up
will break current code.

The reason sizeof array-object is an exception is
that sizeof means "number of bytes of storage
associated with the data object", and if the
exception had not been made, there would be no
reasonable way to say "storage occupied by an entire
array".  I was pretty angry when I found the UTX-32
C compiler claiming that sizeof "xyzzy" was 4 since
that's how big a (char *) is..

Functions are similar in some respects to arrays in
that they have similar name-usage restrictions.

Real problems in C need to be fixed, but the fact
that different types of data have different
properties should not be too upsetting; what would
be the point of different data types otherwise?

Let's get the language standardized as it now
stands and worry about turning it into C++ later.



More information about the Comp.lang.c mailing list