🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #711

Re: Question about ANSI preprocessor

#711
From: David Keppel
Date: Thu, 12 Oct 1989 17:06
31 lines
1471 bytes
[Sorry for the post, e-mail bounced.]

diamond@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@cs.washington.edu
    {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo
Technical Details
Message-ID: <9473@june.cs.washington.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!rice!uw-beaver!uw-june!pardo
References: <10879@riks.csl.sony.co.jp> <11163@smoke.BRL.MIL> <10893@riks.csl.sony.co.jp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!rice!uw-beaver!uw-june!pardo
From: pardo@cs.washington.edu (David Keppel)
Newsgroups: comp.std.c
Subject: Re: Question about ANSI preprocessor
Message-ID: <9473@june.cs.washington.edu>
Date: 12 Oct 89 17:06:31 GMT
References: <10879@riks.csl.sony.co.jp> <11163@smoke.BRL.MIL> <10893@riks.csl.sony.co.jp>
Reply-To: pardo@june.cs.washington.edu (David Keppel)
Organization: University of Washington, Computer Science, Seattle
Lines: 31