ANSI C -- site identification

John Gilmore gnu at hoptoad.uucp
Fri Dec 19 20:04:24 AEST 1986


Martin Minow proposed a way for a program to figure out what machine it
is being compiled for by using __XXX__ names.  Rob Warnock proposed
that these names take values assigned by the Internet folks.  Both parties
missed the boat.

The problem is not that we have no way to tell what machine is being
compiled for.

The problem is that we have a few million tons of code that does so using
#ifdef (and, occasionally, #if), and ANSI C disallows this.

People have suggested that predefining e.g. sun as sun would fix this.
This fixes it for #ifdef and for use in code, but does not fix it for
#if.  If I say

#define sun sun
#if sun

what is the result?  Maybe I am slo tonight, but the result is not
obvious to me...

I think that requiring such configuration #define's to define an identifier
to itself is better than nothing.  Does anyone know of a system that does
that now?  If not, I can't say that we understand the consequences of such
a change.

John Rogers (fortune!foros1!jr) compiled a list of predefined CPP
symbols in 1984 and claimed to be maintaining the list.  I won't tell
you what they all mean, but here is the 1984 list:

AOSVS, DATAGENERAL, DGUX, I8086, ON_SEL, PDP11, PWB, RES, RT, TM_DPS6,
TM_L66, TS, TS_GCOS, TS_MOD400, V7, VIII, VV, __DATE__, __FILE__,
__LINE__, __PAGE__, aegis, aosvs, apollo, cpm, datageneral, decus,
dgux, ebcdic, gcos, hp9000s200, hp9000s500, ibm, ibm370, interdata,
kl10, lint, m68000, m68k, mbb, mc68000, mert, mts, nomacarg, ns32000,
orion, os, pdp11, pe3200, pyr, rsx, sel, selport, sun, tahoe, tops20,
tss, u370, u3b, u3b2, u3b5, univac, unix, vax, vax11c, vms, z8000.

He also proposed adding:

bds, ccpm86, cpm68k, cpm80, cpm86, gnu, i80186, i80286, i8080,
i8086, mc68008, mc68010, mc68020, mpm, msdos, pcdos, power5,
xinu, z80, z800.

In a slightly related area, I second Martin Minow's request for a list
of all the predefined words ("keywords" and library routines and
#define's) in ANSI C.  I suspect that if people saw all the new words
in one place, they would chop back the list, or move those hundreds of
words into the "prefix _" category.  Since the standards folks seem
disinclined, anybody feel like reading the whole text and compiling the
list?  (gee, sounds like another job for machine readable text...)

-- 
John Gilmore  {sun,ptsfa,lll-crg,ihnp4}!hoptoad!gnu   jgilmore at lll-crg.arpa
Call +1 800 854 7179 or +1 714 540 9870 and order X3.159-198x (ANSI C) for $65.
Then spend two weeks reading it and weeping.  THEN send in formal comments! 



More information about the Comp.lang.c mailing list