tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Redefined and undefined enums


From: j . eh
Subject: [Tinycc-devel] Redefined and undefined enums
Date: Wed, 21 Aug 2013 11:29:13 -0500
User-agent: Mutt/1.4.1i

Hi.

Noticed couple of issues with enums.

[1] tcc silently accepts enum redifinition.

$ tcc -run -
enum color { RED=10, GREEN, BLUE };
enum color { R, G, B };
int main()
{
        enum color c=RED, d=R;
        printf("c=%d,d=%d\n", c, d);
        return 0;
}
c=10,d=0


[2] no error reported when using undefined enum.

$ tcc -run -
enum color { RED, GREEN, BLUE };
int main()
{
        enum rgb c=BLUE;        /* undefined enum */
        enum color d=GREEN;
        printf("c=%d,d=%d\n", c, d);
        return 0;
}
c=2,d=1

I was using the source from the mob branch.


Thanks.

John



reply via email to

[Prev in Thread] Current Thread [Next in Thread]