
9 Sep
2011
9 Sep
'11
12:53 p.m.
On 09/09/2011 03:29 AM, Mathias Gaunard wrote:
On 07/09/2011 14:16, John Filo wrote:
I.e. I added:
#elif USE_BIG return *reinterpret_cast<const ubig32_t*>(&src); #elif USE_LITTLE return *reinterpret_cast<const ulittle32_t*>(&src); #elif USE_NATIVE return src;
This breaks aliasing rules.
I wondered about that; I assumed that since the return statement was the only memory read from memory in the function, and that there were no writes that aliasing wouldn't be a problem. Also, I had -Wall on and GCC didn't complain, so I assumed it was okay. I guess I need to read up on what the exact rules are.