> Here it seems GCC is retaining the left hand side type of arr to be
> array of 10 ints whereas on the right hand side
> it has changed its type from array to pointer to integer. I tried

And rightly so.

> searching the relevant sections in the standard ISO C
> document number WG14/N1124 justifying the above behaviour of GCC but
> failed to conclude it from the specifications.

The C99 spec (I only have the draft one, but I think it's pretty
much the same as the final) says, in 6.2.2.3:

 Except when it is the operand of the sizeof operator or the unary &
 operator, or is a character string literal used to initialize an array
 of character type, or is a wide string literal used to initialize an
 array with element type compatible with wchar_t, an lvalue that has
 type ‘‘array of type ’’ is converted to an expression that has type
 ‘‘pointer to type ’’ that points to the initial element of the array
 object and is not an lvalue. If the array object has register storage
 class, the behavior is undefined.

That was spelled out (with different words) in the old K&R C and hasn't
changed since. You can't assign arrays. Since ANSI C you can assign,
pass and return structures and unions, but the array semantics did not
change.

Regards,

Zoltan

Reply via email to