|
|
|
|
|
by gpderetta
531 days ago
|
|
The union trick is actually defined in C. And note that while char can alias anything, the reverse is not true: i.e. you can't generally cast a char array to anything else and expect sensible behaviour. There are ways to make this work (placement new in C++ for example), but it is not a way to escape TBAA: if you store a float in char array you can't then cast it to int with impunity. |
|
[0]: https://en.cppreference.com/w/c/language/union