Question about ANSI preprocessor

David Keppel pardo at cs.washington.edu
Fri Oct 13 03:06:31 AEST 1989


[Sorry for the post, e-mail bounced.]

diamond at riks. (Norman Diamond) writes:
 >For example, consider:
 >
 >  #include <stdio.h>
 >  #define mf1(x) printf("Hello, world.\n")
 >  #define m2     (z);
 >  main(){
 >    mf1 m2
 >  }
 >
 >I will bet that every pre-ANSI compiler/preprocessor would have
 >rejected the above program.  But ANSI requires it to print
 >"Hello, world.\n".

I tried this on gcc v 1.36/VAX with the `-ansi' flag and got `m2 (z)'.
Should I be filing a bug report?  `gcc' is generally pretty robust
about such things...

 >In fact I think I can construct a few perverse macros, which will make
 >the preprocessor take EXPONENTIAL TIME in proportion to the length of
 >the program.

That should make an interesting submit to the Obfuscated C contest!

	;-D on  ( What do you mean, `non-obfuscated C' ?-)  Pardo
-- 
		    pardo at cs.washington.edu
    {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo



More information about the Comp.std.c mailing list