[comp.lang.c] pre#defined cpp symbols

billj@zaphod.UUCP (07/24/87)

Some of the old hand net.lang.c readers may remember an article posted
in September '84 by foros1!jr, and reposted in April '86 by
convexs!hosking, detailing the symbols predefined by various cpp
versions.  The table below is drawn from that article, and slightly
updated by me to remove versions I thought extremely rare, and add
others I knew of.  I am interested in updating it:  if you know of
errors, omissions, or versions now obsolete, please send me mail.  I
will collect responses for about two weeks before posting an updated
version.

              Predefined Preprocessor Symbols

 Name          Description and availability
 __DATE__      date of compilation: ANSI, Decus C
 __FILE__      current source file name: ANSI, most
 __LINE__      line number within source file: ANSI, most
 __PAGE__      page number within source file: Data General
 __STDC__      standard, i.e. ANSI, C
 __TIME__      time of compilation, e.g. "14:22:00": ANSI
 AOSVS         Data General AOS/VS operating system
 aosvs         Data General AOS/VS operating system
 apollo        Apollo workstations
 bsd4_2        Berkeley 4.2 Unix: Ultrix
 DATAGENERAL   Data General hardware
 datageneral   Data General hardware
 decus         Decus C (PDP-11 RSX, RSTS, RT-11)
 DGUX          Data General Unix
 dgux          Data General Unix
 gcos          Honeywell 6000 GCOS system (AT&T only?)
 GFLOAT        Ultrix compiling 8-byte floating point
 ibm           IBM and Amdahl mainframes (AT&T only?)
 interdata     Interdata 8/32 (AT&T only?)
 hp9000s200    Hewlett-Packard 9000 HP/UX
 hp9000s500    Hewlett-Packard 9000 HP/UX
 kl10          DEC-20 KL10 processor: U of Utah pcc
 lint          being processed by lint
 m68000        Motorola M68000 family: CCI
 m68k          Motorola M68000 family: Motorola SysV
 mc68000       Motorola M68000 family: Sun, Fortune, others
 mert          AT&T MERT variant of Unix
 nomacarg      cpp without macro arguments: Decus C
 orion         Orion supermicro
 os            IBM OS/360, /370 (AT&T only?)
 pdp11         DEC PDP-11: Unix V7, Decus C
 PWB           Programmer's workbench variant
 RES           AT&T Research Unix
 rsx           DEC PDP-11 RSX: Decus C
 RT            AT&T UNIX/RT
 sel           Gould Concept 32
 selport       Gould Concept 32
 sun           Sun Microsystems workstations
 SYSTEM_FIVE   Ultrix SysV emulation
 TM_DPS6       Honeywell DPS 6: Waterloo C
 TM_L66        Honeywell Level 66: Waterloo C
 tops20        DEC-20 TOPS-20: U of Utah pcc
 TS            AT&T UNIX/TS for IBM
 TS_GCOS       Honeywell GCOS 8: Waterloo C
 TS_MOD400     Honeywell GCOS 6 model 400: Waterloo C
 tss           AT&T C under IBM TSS
 u370          AT&T Unix on IBM 370
 u3b           AT&T Unix on 3B series
 u3b2          AT&T Unix on 3B-2
 u3b20         AT&T Unix on 3B-20
 u3b5          AT&T Unix on 3B-5
 ultrix        DEC's Ultrix variant
 univac        Univac/1100 Unix
 unix          any Unix
 uts           Amdahl UTS variant
 vax           DEC VAX computers
 vax11c        DEC (VMS/Ultrix) VAX-11 C
 vms           DEC VMS operating system: VAX-11 C
 z80           Zilog Z80: Vandata C
 z8000         Zilog Z8000
-- 
Bill Jones, Develcon Electronics, 856 51 St E, Saskatoon S7K 5C7 Canada
uucp:  ...ihnp4!sask!zaphod!billj               phone:  +1 306 931 1504

wsmith@uiucdcsb.cs.uiuc.edu (07/25/87)

There is also
ibm032 -- IBM RT, Berkeley Unix  (not sure what it in AIX)

A useful way of finding out what is defined (if you're on a Unix
system) is to run `strings /lib/cpp`.  Usually they are all grouped
together.

Bill Smith
ihnp4!uiucdcs!wsmith
wsmith@a.cs.uiuc.edu

stevens@hsi.UUCP (Richard Stevens) (07/27/87)

> 
> A useful way of finding out what is defined (if you're on a Unix
> system) is to run `strings /lib/cpp`.  Usually they are all grouped
> together.
> 

I've tried using strings to find these and it doesn't always seem to
work.  For example, 'strings /lib/cpp | grep vax' on a 4.3 system
won't show 'vax' as being predefined, but it is.  Looking at the source
for cpp shows that both "vax" and "unix" are put into the symbol table
the same way.

Also, I was just trying to find all the predefined symbols under SCO Xenix
using strings and none of the 'M_I86xM' symbols show up, yet they are defined.

Anyone know why ??

	Richard Stevens
	Health Systems International, New Haven, CT
           ihnp4 ! hsi ! stevens

grr@cbmvax.UUCP (George Robbins) (07/28/87)

In article <657@hsi.UUCP> stevens@hsi.UUCP (Richard Stevens) writes:
> 
> I've tried using strings to find these and it doesn't always seem to
> work.  For example, 'strings /lib/cpp | grep vax' on a 4.3 system
> won't show 'vax' as being predefined, but it is.  Looking at the source
> for cpp shows that both "vax" and "unix" are put into the symbol table
> the same way.
> 
> Also, I was just trying to find all the predefined symbols under SCO Xenix
> using strings and none of the 'M_I86xM' symbols show up, yet they are defined.
> 
> Anyone know why ??

Several of the strings implementations I've seen somehow manage to avoid
starting at the beginning of the data segment.  Perhaps through some kind of
accounting error in working out the file offset, I guess.  There's a pretty
good chance these string constants come up first thing in the file and aren't
printed out.

It is also possible that the compiler controlling program "cc" is inserting
-Dxxxxx type defines when it passes the command line paramenters to "cpp".
The details differ from system to system.

-- 
George Robbins - now working for,	uucp: {ihnp4|seismo|rutgers}!cbmvax!grr
but no way officially representing	arpa: cbmvax!grr@seismo.css.GOV
Commodore, Engineering Department	fone: 215-431-9255 (only by moonlite)

richard@aiva.ed.ac.uk (Richard Tobin, JANET: R.Tobin@uk.ac.ed ) (07/28/87)

In article <657@hsi.UUCP> stevens@hsi.UUCP (Richard Stevens) writes:
>I've tried using strings to find these and it doesn't always seem to
>work.  For example, 'strings /lib/cpp | grep vax' on a 4.3 system
>won't show 'vax' as being predefined, but it is.  Looking at the source

True, but this:

   strings -3 /lib/cpp | grep vax

works just fine.
-- 
Richard Tobin,                           JANET: R.Tobin@uk.ac.ed             
AI Applications Institute,               ARPA:  R.Tobin%uk.ac.ed@cs.ucl.ac.uk
Edinburgh University.                    UUCP:  ...!ukc!ed.ac.uk!R.Tobin

alanm@dvlmarv.UUCP (07/29/87)

>Also, I was just trying to find all the predefined symbols under SCO Xenix
>using strings and none of the 'M_I86xM' symbols show up, yet they are defined.

Try running strings on cc.

peter@sugar.UUCP (Peter da Silva) (08/03/87)

Add:
	i8088
	i80286
	i80386	-- Lattice 'C' for the IBM-PC
	sm80*	-- Small Model ditto
	pm80*	-- Large Code model ditto
	dm80*	-- Large Data model ditto
	lm80*	-- Large Model ditto

Gross but true.
-- 
-- Peter da Silva `-_-' ...!seismo!soma!uhnix1!sugar!peter (I said, NO PHOTOS!)

alastair@geovision.UUCP (Alastair Mayer) (08/04/87)

In article <657@hsi.UUCP> stevens@hsi.UUCP (Richard Stevens) writes:
 >> 
 >> A useful way of finding out what is defined (if you're on a Unix
 >> system) is to run `strings /lib/cpp`.  Usually they are all grouped
 >> together.
 >> 
 >
 >I've tried using strings to find these and it doesn't always seem to
 >work.  For example, 'strings /lib/cpp | grep vax' on a 4.3 system
 >won't show 'vax' as being predefined, but it is.  Looking at the source
 >for cpp shows that both "vax" and "unix" are put into the symbol table
 >the same way.
 >
 >Also, I was just trying to find all the predefined symbols under SCO Xenix
 >using strings and none of the 'M_I86xM' symbols show up, yet they are defined.
 >
 >Anyone know why ??

I don't know why strings wouldn't find 'M_I86xM' symbols, but it won't
find "vax" or any other short identifier because the algorithm strings
uses is to search for sequences of *four* or more printable characters.
You could change strings (or write your own) to look for fewer characters,
but the tradeoff is the signal to noise ratio, getting garbage sequences
of bytes that just happen to look like characters.
-- 
 Alastair JW Mayer     BIX: al
                      UUCP: ...!utzoo!dciem!nrcaer!cognos!geovision!alastair

(Why do they call it a signature file if I can't actually *sign* anything?)

jv@mhres.mh.nl (Johan Vromans) (08/06/87)

Bill Jones <bill@zaphod.UUCP> writes:

> Name	Description and availibility
> ...
> unix	Any unix

So it is clear by now, that Xenix is not unix. It does not have "unix"
defined. 

Richard Stevens <stevens@hsi.UUCP> writes:

> .. For example, 'strings /lib/cpp | grep vax' ... won't show 'vax'
> as being predefined.

Isn't there a lower limit on the number of consequetive alphanumeric
characters accepted by 'strings'? Most systems I know need at least four
characters. 

By the way - add

  vaxc  VAX/VMS C version 2 and higher. DEC is phasing out the
	"-11" postfix for most vax products. I think they want to
	forget that VAX really is a "Virtual Address Extension of
	the PDP-11"
		
-- 
Johan Vromans                           | jv@mh.nl via mcvax and seismo
Multihouse N.V., Gouda, the Netherlands | uucp: ..{seismo!}mcvax!mh.nl!jv
"It is better to light a candle than to curse the darkness"

mouse@mcgill-vision.UUCP (der Mouse) (08/07/87)

>> [You can find out pre#defined cpp symbols with] `strings /lib/cpp`.

> [...], 'strings /lib/cpp | grep vax' on a 4.3 system won't show 'vax'
> as being predefined, but it is.

This is most likely because by default, strings doesn't mention strings
shorter than four characters.  This is to reduce noise strings cause by
random concatenations of bytes that happen to represent printable
characters.  (You can change this to, say, three by using "strings -3").

					der Mouse

				(mouse@mcgill-vision.uucp)