Re: [cc65] testsuite - compiler bugs!

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-03-06 13:03:54


On Wed, Mar 05, 2003 at 09:34:58PM +0200, Marko Mäkelä wrote:
> I too thought that the braces are only allowed when initializing an
> array, struct or union ("union { int x, char* y } a = {0}" would
> assign a.x = 0; it's always the first component of the union).

Just looked it up in the standard (6.7.8 Initialization): It does not only
allow any number of nested, matching curly braces. Even a trailing comma is
allowed! So

        unsigned a = {{{{ 3, },},},};

is legal C. gcc will print a warning if more than one level of curly braces is
present for scalar initializers, but it's just a warning, even with when
compiling -ansi. Which is correct, because it's weird but legal:-)
        
Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-03-06 13:04:01 CET