Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If the language supports union, then simply give your working variable the type of "union { float, long }". This directly expresses the idea that you're working with a piece of memory that is used for two purposes.


If the language supports untagged unions, it isn't strongly typed. With very few exceptions.


Untagged unions between two non-pointer types with the same representation (same number of bits) are perfectly safe, they are just ordinary bit-casts.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: