Xref: utzoo comp.unix.questions:13143 comp.std.c:1113 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!mit-eddie!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.unix.questions,comp.std.c Subject: Re: How can I find out cc or cpp symbols? Summary: Trust me, I know what I'm doing... (BLAM!) Message-ID: <2724@buengc.BU.EDU> Date: 30 Apr 89 09:25:52 GMT References: <1954@trantor.harris-atd.com> <1938@csuna.csun.edu> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.unix.questions Distribution: na Organization: Boston Univ. Col. of Eng. Lines: 52 In article <1938@csuna.csun.edu> abcscnge@csuna.csun.edu (Scott Neugroschl) writes: >In article <1954@trantor.harris-atd.com> bbadger@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 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..."