Warning when using const pointer to fixed size array

Aaron Rocha hxdg21@yahoo.com
Tue Dec 1 00:24:00 GMT 2009


This is the correct syntax when declaring a pointer to a fixed size array.
It is not something you usually see in C code but it is perfectly legal
syntax.

Back to my original question though. Why does gcc give that warning? It 
should be legal to point a const pointer to a non-const variable and use 
the pointer for read-only access, right? So why the warning? Is this a bug 
in GCC?

Cheers

--- On Mon, 11/30/09, me22 <me22.ca@gmail.com> wrote:

> From: me22 <me22.ca@gmail.com>
> Subject: Re: Warning when using const pointer to fixed size array
> To: "Thomas Martitz" <thomas.martitz@student.htw-berlin.de>
> Cc: gcc-help@gcc.gnu.org
> Received: Monday, November 30, 2009, 5:08 PM
> 2009/11/30 Thomas Martitz <thomas.martitz@student.htw-berlin.de>:
> >
> > I didn't try gcc, but visual studio compiler gives an
> error on that one.
> >
> 
> I tried it in gcc 4.3.2, where it worked fine.
> 


      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/



More information about the Gcc-help mailing list