Pointers and Arrays

karl at haddock karl at haddock
Wed Aug 20 11:40:00 AEST 1986

dg_rtp!throopw (Wayne Throop) writes:
>And [in ANSI C] it's still a little difficult to get an array-typed
>rvalue, so assignment still doesn't work, even aside from the fact that
>ANSI doesn't make array-typed lvalues modifiable.

I've got some ideas about that, but the first step is to deprecate the
"feature" that allows you to write "f(int a[])" for "f(int *a)".  (I refer
here to the declaration of the function, not its call.)  In my mind, since
arrays may not currently be passed as arguments, the declaration is an error,
and the compiler is "politely" figuring out what you must have *meant*.  As
has already been pointed out, "sizeof(a)" gives you "sizeof(int *)" in this
context, so the apparent acceptance of the declaration tends to be confusing.

Karl W. Z. Heuer (ihnp4!ima!haddock!karl), The Walking Lint

More information about the Comp.lang.c mailing list