From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24987 invoked by alias); 29 Oct 2008 10:27:06 -0000 Received: (qmail 24581 invoked by uid 48); 29 Oct 2008 10:25:42 -0000 Date: Wed, 29 Oct 2008 10:27:00 -0000 Subject: [Bug c++/37949] New: static initialisation through pointer deferred until run time X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ajrobb at bigfoot dot com" 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 X-SW-Source: 2008-10/txt/msg01895.txt.bz2 Given various methods for determining byte order on different platforms, the following can be used in C++ to find the byte order across platforms. static const uint32_t bytes = 0x03020100ul; static const unsigned lo = *(const unsigned char*)&bytes; Unfortunately, the value of 'lo' is determined at pre-run rather than at compile time. It would be useful if the compiler could determine the value of 'lo' so as to eliminate constant logical tests and jumps. -- Summary: static initialisation through pointer deferred until run time Product: gcc Version: 4.2.4 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ajrobb at bigfoot dot com GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37949