Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site turtlevax.UUCP
Path: utzoo!linus!decvax!ittvax!qumix!amd!turtlevax!ken
From: ken@turtlevax.UUCP (Ken Turkowski)
Newsgroups: net.lang.c
Subject: Re: Standardization questions (cpp mostly)
Message-ID: <554@turtlevax.UUCP>
Date: Mon, 8-Oct-84 00:55:47 EDT
Article-I.D.: turtleva.554
Posted: Mon Oct  8 00:55:47 1984
Date-Received: Tue, 9-Oct-84 20:14:26 EDT
References: decvax.83 <1209@rti-sel.UUCP>
Organization: CADLINC, Inc. @ Palo Alto, CA
Lines: 33

> WHAT IS WRONG
> A predefined variable is produced with explicit code in cpp,
> with the '-Dvax' argument to cpp, or with '#define vax 1'
> The result is that 'vax' evaluates to '1', which is fine if
> people want to say '#ifdef vax' or (gag me) '#if vax'
> but not so hot if you want to compile a portable (hear hear!)
> program that happens to use 'vax' as a variable.
> 
> THE FIX
> We should return to the old days when vax was really 'vax',
> unix was really 'unix', and small furry creatures were still single.
> Here is a weak attempt at how it might be worded:
> 	The effect of '#define foo foo' and also '-Dfoo' as an option
> 	will be to make 'foo' defined and to evaluate to itself.
> 	Subsequently, foo and defined(foo) will both evaluate to 1
> 	within a #if, foo will be considered defined within a #ifdef
> 	or #ifndef, and foo will have no special meaning elsewhere.
> 
> DISCUSSION
> This change is minor and would not break any existing programs.
> People need no longer live in fear of the 'printf' machine
> that is to be announced early next year.
> 
> I am not sure if '#define unix unix' should be handled as
> a special case (ordinarily it would result in a cpp loop),

The C preprocessor used to behave as you desire on version 6.  I seem
to recall documantation that implied that special code was used to
prevent infinite looping.
-- 
Ken Turkowski @ CADLINC, Palo Alto, CA
UUCP: {amd,decwrl,flairvax,nsc}!turtlevax!ken
ARPA: turtlevax!ken@DECWRL.ARPA