This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: type based aliasing again - meaning of "undefined"


>>>>> "Michael" == Michael Meissner <meissner@cygnus.com> writes:

    Michael> Also note the rules for ANSI C are different from ANSI
    Michael> C++ in terms of const.  

I'm not aware of that, but it's possible.

    Michael> For example, I recall the following:

    Michael> 	int i; *(int *)(const int *)&i = 1;

    Michael> is legit under ISO C.  IIRC, this is explicitly mentioned
    Michael> in one of the TC's (I was still a member of the committee
    Michael> when TC.1 came out).

This is legal C++ as well.  It's the `const'-ness of the underlying
object that matters, just as with the alias issues it's the type of
thing actually pointed to that matters.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]