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: Linux and aliasing?


Linus Torvalds wrote:
> > I think by now you've been presented with a variety of strategies for
> > solving the problem in the kernel, including more than one idea for
> > macros that you could use like:
> > 
> >   ALIASING_CAST (type, x)
> 
> I've been told in private email, that the proposed macro wasn't even
> standards conforming in the sense that it doesn't guarantee that the
> compiler couldn't decide it aliases (because in order to guarantee that
> the union should contain all possible types). It happens to work for gcc.

Luckily, GCC has __typeof__.
So you can just put the target type and __typeof__(x) in the union --
should work shouldn't it?

-- Jamie


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