Re: Warning when using const pointer to fixed size array

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

 



It is indeed hard to tell. You did answer my question though (i.e., by pointing where in the C standard that operation was not allowed. I wasn't sure that was the case).

Thanks for taking the time to look into this, Andrew.

--- On Tue, 12/1/09, Andrew Haley <aph@xxxxxxxxxx> wrote:

> From: Andrew Haley <aph@xxxxxxxxxx>
> Subject: Re: Warning when using const pointer to fixed size array
> To: "Aaron Rocha" <hxdg21@xxxxxxxxx>
> Cc: gcc-help@xxxxxxxxxxx
> Received: Tuesday, December 1, 2009, 9:22 AM
> Aaron Rocha wrote:
> >> I am one.
> > 
> > Sweet! Then I got to the right person :)
> > 
> >> 6.7.3 Para 8: "If the specification of an array
> type includes any
> >> type qualifiers, the element type is so qualified,
> not the array
> >> type.  For two qualified types to be
> compatible, both shall have
> >> the identically qualified version of a compatible
> type."
> > 
> > Thanks for the clarification, Andrew.. This is all I
> needed to know. 
> > 
> > Apparently, the standard is slightly different for C++
> because I don't 
> > get a warning in the same situation. This is the
> clarification I was 
> > seeking regarding the C standard.
> 
> C++ uses very different language when talking about this:
> 
> 
> 3.9.2 Compound types
> 
> Pointers to cv-qualified and cv-unqualified versions
> (3.9.3) of
> layout-compatible types shall have the same value
> representation and
> alignment requirements (3.9).
> 
> 
> 3.9.3 CV-qualifiers
> 
> The cv-qualified or cv-unqualified versions of a type are
> distinct
> types; however, they shall have the same representation and
> alignment
> requirements 46)
> 
> 46) The same representation and alignment requirements are
> meant to
> imply interchangeability as arguments to functions, return
> values from
> functions, and members of unions.
> 
> 
> By which I understand that the same rules as C apply. 
> I think.
> It's hard to tell...  :-)
> 
> Andrew.
> 


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

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



[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