This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/59854] New: Types with specific endianness
- From: "hpa at zytor dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 17 Jan 2014 06:41:02 +0000
- Subject: [Bug c/59854] New: Types with specific endianness
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59854
Bug ID: 59854
Summary: Types with specific endianness
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: hpa at zytor dot com
For integer (and ideally floating-point) types, it would be very nice to be
able to explicitly specify bigendian or littleendian, with the definition that
when stored in memory, these types are byteswapped if necessary. This would
allow a much more natural and less error-prone way to build data structures for
interchange than what is currently possible.
Obviously, the "as if" rule applies: if it is not observable that something is
stored in memory (e.g. a stack variable for which an address is never taken)
the compiler is allowed to elide the byte swapping as an optimization.
Ideally, this should be added to the C and C++ standards, but perhaps an
implementation in gcc would help make that actually happen.