This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 3.1.1 --std=c99: initializer element is not constant ...
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Craig Newell <craign at ieee dot org>
- Cc: <gcc-bugs at gcc dot gnu dot org>
- Date: Sun, 26 May 2002 20:43:23 +0100 (BST)
- Subject: Re: GCC 3.1.1 --std=c99: initializer element is not constant ...
On Sun, 26 May 2002, Craig Newell wrote:
> Lock lock = (Lock){ (void*)0 };
The compound literal (Lock){ (void*)0 } is an unnamed object of type Lock,
according to the C99 standard, not a constant expression. That is, your
code is equivalent to
Lock unnamed_lock_init = { (void*)0 };
Lock lock = unnamed_lock_init;
which clearly involves a nonconstant initializer unnamed_lock_init.
--
Joseph S. Myers
jsm28@cam.ac.uk