Re:Confessions of a terrible programmer
by noamsml on Sunday March 15, 2009 @10:21AM
(#516840)
C has no types, as a quick (int*)&var will show.
[ Parent
| on HN ]
Unfortunately, this is not true in the case of type punning. C used to be the language you used when you wanted to access bits. Now with C99 you cannot * (int16* )((int32* )x).
NB, all compilers make exceptions for unions, but the type punning rule stands, and at work we've actually seen code like the above (for a dynamic typing system) compile to NULL instead of the appropriate reference with GCC. Grrrrrrr.