Fun corners of the C standard...

John Carter john.carter@tait.co.nz
Tue Mar 24 03:59:00 GMT 2009


I love reading language grammars....

...to see what weird dysfunctional crap would be accepted by the
grammar, but could have no possible meaning to the instruction
generator phase of a compiler.

Like this...

======================================================================
typedef;
const;
volatile;
extern;
static;

void boo()
{
    auto;
    typedef const volatile;
    register volatile;
    static volatile;
}
======================================================================

Believe it or not, that actually compiles without errors. A good
supply of warnings mind you, but no errors and an object file is
generated.

If I compile that with gcc -O3 -fomit-frame-pointer -c and disassemble
it with objdump -S I get...

00000000 <boo>:
    0:	f3 c3                	repz ret

Fun (in a twisted dysfunctional) kind of way.



John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter@tait.co.nz
New Zealand



More information about the Gcc-help mailing list