News for hackers. Stuff that matters.
Re:Fare: Metaprogramming from the ground up: avoid C by qwph on Tuesday September 16, 2008 @01:18AM (#305456)
But that doesn't mean it is impossible to write trivial harmful metaprograms in CPP, as is easily demonstrated in my counter-example die_die_stupid_c_compiler.c

I'm slightly disappointed that

  gcc -E die_die_stupid_c_compiler.c
didn't die, although it did produce about 750k of output, which is quite impressive...
Re:Fare: Metaprogramming from the ground up: avoid C by kinghajj on Tuesday September 16, 2008 @01:33AM (#305471)
Can anyone explain why this takes so long to compile? It doesn't look that complicated.

Edit: I compiled with "gcc -O3 -s", which took 8 minutes, but the executable is only 4784 bytes.

Re:Fare: Metaprogramming from the ground up: avoid C by fp on Tuesday September 16, 2008 @03:45AM (#305548)
The long compilation time is due to the optimization options. Without optimization it compiles in a few seconds.

Yet, the macros leave plenty of space for optimization. See the size of your executable compared to the unoptimized one of qwph above.