How can I find out cc or cpp symbols?

Blair P. Houghton bph at buengc.BU.EDU
Sun Apr 30 19:25:52 AEST 1989


In article <1938 at csuna.csun.edu> abcscnge at csuna.csun.edu (Scott Neugroschl) writes:
>In article <1954 at trantor.harris-atd.com> bbadger at x102c.harris-atd.com (Bernie Badger Jr.) writes:
>>Is there a way to find out what macros are defined?  It's particularly hard 
>>to predict which names will be _predefined_.
>
>I am also interested in finding out about what are the "manifest defines" of
>a CC implementation.  I write code for 5 different platforms, and would
>like it to be semi-portable (e.g. 
>
>#if vax || M_8086
>	read(fd,&data,nbytes);
>	swab(&data,&data,nbytes);	/* swap for byte swapped machine */
>#endif
>
>	System				Manifest Defines
>	------------------		---------------------
>	SCO Xenix SysV/286		(M_8086 or some such)
>	AT&T 3B15			(don't know)
>	VAX/Ultrix			(vax)
>	Motorola System V/68		(m68k????)
>	ZEUS (Zilog Unix Sys III)	(z8000)
>
>Each of these has their own manifest defines, but they are not well
>documented (if at all).  IMHO, the man page for cc(1) or cpp(1) should
>specify what that particular preprocessor implementation pre-defines.
>I like the suggestion for #dump "file".  Did anyone suggest this to
>the X3J11 committee?

I think I understand, but if I don't, it will be obvious, but it's no
less instructive, what I have to say, so...

I once wanted to know which set of numbers I would be getting from
#include <values.h> on a certain machine.  (The Encore Multimax,
for which your table's entry, for this particular machine, would go
	Multimax/Umax			(ns32000)	.)
So, while the sysadmin was looking it up, I decided just to monkey
with all the #ifdef's in values.h to see which ones came up.
I just took out all the #define statements and replaced them with
`printf ("ns32000 || vax");' and the like, depending on what the in-scope
#ifdef's were using.  To be certain, I threw in an #else for each #ifdef
(if it wasn't already there) to say `printf("NOT blivit || foobus || vax");'
or whatever needed to be said.

So, it seems, if necessary you can always go looking into values.h to see
which 'manifest defines' your implementation is using.

The least you can get is a list of the ones it _could_ be using, and
cobble up a string of #ifdef/printf/#endif chunks to find out for sure.

				--Blair
				  "Predicated on the portability of
				   values.h, of course..."



More information about the Comp.unix.questions mailing list