Re: array semantic query

2009-07-18 Thread dharmendra pandit
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

array semantic query

2009-07-18 Thread dharmendra pandit
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

Re: array semantic query

2009-07-18 Thread dharmendra pandit
According to 6.3.2.1 Para 3, the type conversion from array of type to pointer to type should happen irrespective of whether the operand is on right had side or the left hand side of assignment operator. But GCC is converting only the right side operator type to pointer of type while retaining the

Re: array semantic query

2009-07-18 Thread Richard Guenther
On Sat, Jul 18, 2009 at 2:18 PM, dharmendra panditpandit.dharmen...@gmail.com wrote: According to 6.3.2.1 Para 3, the type conversion from array of type to pointer to type should happen irrespective of whether the operand is on right had side or the left hand side of assignment operator. But

Re: array semantic query

2009-07-18 Thread Zoltán Kócsi
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