[Bug c/59854] New: Types with specific endianness
hpa at zytor dot com
gcc-bugzilla@gcc.gnu.org
Fri Jan 17 06:41:00 GMT 2014
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.
More information about the Gcc-bugs
mailing list