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]
Other format: [Raw text]

Re: Type-punning


Herman Geza <hg211@hszk.bme.hu> writes:

> Yes, it's clear now, thanks.  However, it brings a new question: the 
> standard defines layout-compatible types. For example, if I'm correct, my Vector 
> and Point are layout compatible.  What can I do with layout compatible 
> objects?

You can put them in a union and be able to use the common initial
sequence of either alternative, see 6.5.2.3[#5].  Once you have defined
such a union, objects of either type can alias each other.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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