Re: array semantic query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/18/2009 10:35 AM, dharmendra pandit wrote:
> Hi,
> 
> I tried the following simple code segment in gcc and it gave the
> incompatible type error as mentioned below.
> 
> int main() {
>     int arr[10];
>     arr = arr;   // error: incompatible types when assigning to type
> ‘int[10]’ from type ‘int *’
> }
> 
> 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
> 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.
> It would be of great help if someone can point me out the relevant
> sections from the specs.

6.3.2.1 Para 3.

I'm surprised you ask, since this convention has been used since early
K&R C.

Andrew.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux