4 ms·
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 workin
by phaedrus 12y ago
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.
- TheLoneWolfling 12y agoIf the language supports untagged unions, it isn't strongly typed. With very few exceptions.
- tomp 12y agoUntagged unions between two non-pointer types with the same representation (same number of bits) are perfectly safe, they are just ordinary bit-casts.