From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31543 invoked by alias); 17 Jan 2014 06:41:07 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 31505 invoked by uid 48); 17 Jan 2014 06:41:02 -0000 From: "hpa at zytor dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/59854] New: Types with specific endianness Date: Fri, 17 Jan 2014 06:41:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: hpa at zytor dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg01803.txt.bz2 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.