2 ms·
Don’t think c++ allows it. Last time I checked, if you use any modern compiler, and do a memcpy, and check the assembly, it does the right thing.
by maccard 8y ago
Don’t think c++ allows it. Last time I checked, if you use any modern compiler, and do a memcpy, and check the assembly, it does the right thing.
- saagarjha 8y agoYes, that's the "approved" way of doing type punning. Any decent compiler will immediately optimize that down to nothing.