This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]