Boost logo

Boost :

Subject: Re: [boost] [Endian] Performance
From: Beman Dawes (bdawes_at_[hidden])
Date: 2011-09-09 11:45:20

On Fri, Sep 9, 2011 at 8:53 AM, John Filo <filo_at_[hidden]> wrote:

> 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.

I'm missing something. Could you please post the full function, without any
preprocessing statements, where the aliasing issue is arising?



Boost list run by bdawes at, gregod at, cpdaniel at, john at