public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: dharmendra pandit <pandit.dharmendra@gmail.com>
To: gcc@gcc.gnu.org
Subject: Re: array semantic query
Date: Sat, 18 Jul 2009 09:35:00 -0000	[thread overview]
Message-ID: <6215dcff0907180235g7b4e6b7bl18f151db959a989d@mail.gmail.com> (raw)
In-Reply-To: <6215dcff0907180232l1c7291eclbc006cabd02224a4@mail.gmail.com>

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.

Thanks
Dharmendra

       reply	other threads:[~2009-07-18  9:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6215dcff0907180232l1c7291eclbc006cabd02224a4@mail.gmail.com>
2009-07-18  9:35 ` dharmendra pandit [this message]
     [not found]   ` <4A61A230.9000703@redhat.com>
2009-07-18 12:18     ` dharmendra pandit
2009-07-18 12:26       ` Richard Guenther
2009-07-18 12:31   ` Zoltán Kócsi
2009-07-18  9:38 dharmendra pandit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6215dcff0907180235g7b4e6b7bl18f151db959a989d@mail.gmail.com \
    --to=pandit.dharmendra@gmail.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).