This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Byte swapping support
- From: <Paul dot Koning at dell dot com>
- To: <juerg dot billeter at codethink dot co dot uk>
- Cc: <gcc at gcc dot gnu dot org>, <ebotcazou at adacore dot com>
- Date: Tue, 12 Sep 2017 14:15:13 +0000
- Subject: Re: Byte swapping support
- Authentication-results: sourceware.org; auth=none
- References: <1505208772.3423.7.camel@codethink.co.uk>
> On Sep 12, 2017, at 5:32 AM, Jürg Billeter <juerg.billeter@codethink.co.uk> wrote:
>
> Hi,
>
> To support applications that assume big-endian memory layout on little-
> endian systems, I'm considering adding support for reversing the
> storage order to GCC. In contrast to the existing scalar storage order
> support for structs, the goal is to reverse the storage order for all
> memory operations to achieve maximum compatibility with the behavior on
> big-endian systems, as far as observable by the application.
I've done this in the past by C++ type magic. As a general setting it doesn't make sense that I can see. As an attribute applied to a particular data item, it does. But I'm not sure why you'd put this in the compiler when programmers can do it easily enough by defining a "big endian int32" class, etc.
paul