Fun corners of the C standard...

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

 



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@xxxxxxxxxx
New Zealand


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux