This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: Yet another aliasing question.


Andrew Haley <aph@redhat.com> writes:

> Sergei Organov writes:
>
>  > I'm trying to understand the implications of strict aliasing rules on
>  > programming practices. I've got two example functions foo() and boo()
>  > that I think both are valid from the POV of strict aliasing
>  > rules.
>
> It's hard to discuss this without looking at the standard.  Can you
> please quote the exact language in the standard thta justfies your
> opinion?

Yes, sure:

  An object shall have its stored value accessed only by an lvalue
  expression that has one of the following types:

  - a type compatible with the effective type of the object,
  [...]
  - an aggregate or union type that includes one of the aforementioned
    types among its members (including, recursively, a member of a
    subaggregate or contained union)


-- Sergei.


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