1 |
On 07/01/2011 04:04 AM, Frank Peters wrote: |
2 |
> A few days ago I posted about a possible problem with a floating |
3 |
> point test called the UCBTEST. After examining the source code |
4 |
> of this test, I see violations of aliasing rules throughout. |
5 |
> It's hard to efficiently manipulate variables without them. |
6 |
|
7 |
You can alias them with a char* (a char pointer can alias everything in |
8 |
a valid and defined manner). What you do is use the char* to scan over |
9 |
the target type. And since a char is always guaranteed to be 8 bits, |
10 |
it's very suited for doing endian conversions. |