Re: The joy of type aliasing and C
"Alen Ladavac" <[email protected]>
| Newsgroups | gmane.games.devel.general |
|---|---|
| Message-ID | <000c01c3d1d7$93c57130$73665bd4@elrond> |
>int x = ( int & ) f; >int x = * ( int * ) &f; >In the above, both the 'f' are considered lvalues, since they are >expressions with an object type. I thought so. :/ >> The reinterpret_cast operator is _designed_ to be used for type >> punning, isn't it? >Typically only for modifying pointer types, e.g. derived pointer to >base class, etc. But it does compile without errors when used to do type punning (FWIK). Weirdo. Is there some statement in the standard, ignored by compilers, that says it shouldn't? I'm not reading the standard, but some Deep C++ articles, saying: "While the Standard gives static_cast a sweeping general property plus a complicated set of exceptions, it limits reinterpret_cast to two fundamental roles: - Conversions to and from pointers - Overlaying an lvalue with multiple types (a.k.a. type punning) " So maybe that creates some confusion. Is the statement above correct? Alen ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ Gamedevlists-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-general Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=557