|
|
|
|
|
by blorsh
2928 days ago
|
|
No, type punning via unions is a gcc extension. The standard only allows reading a value as the type it was written with or as char, and an access as char is only good for copying. If a char access used different bit order, that would be OK according to the standard because you couldn't tell unless you violated the standard. It seems every compiler will tolerate a memcpy for type punning, even though this isn't required. |
|
https://stackoverflow.com/questions/11639947/