Xref: utzoo comp.unix.questions:13231 comp.std.c:1143 Path: utzoo!mnetor!tmsoft!dptcdc!lethe!dave From: dave@lethe.UUCP (Dave Collier-Brown) Newsgroups: comp.unix.questions,comp.std.c Subject: Re: How can I find out cc or cpp symbols? Keywords: cpp, cc, macros Message-ID: <2432@lethe.UUCP> Date: 3 May 89 02:27:33 GMT References: <1954@trantor.harris-atd.com> <1938@csuna.csun.edu> Reply-To: dave@lethe.UUCP (Dave Collier-Brown) Distribution: na Organization: Interleaf Canada, news courtesy of Systems Software Lines: 49 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_. In article <1938@csuna.csun.edu> abcscnge@csuna.csun.edu (Scott Neugroschl) writes: | 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 ... Well, its formally impossible to predict what names will (eventually) be predefined. So I recommend approaching the problem from a different direction. What you want to know is whether or not a certain capability is present, and if so how to access it. Saying "#ifdef 4.2BSD" is far too coarse for most typical problems. So I depend on a bug (!). C compilers used to depend on sequences of #ifdefs to ensure that the contents of system .h files were not inadvertently redefined by including the containing files more than once. Even ANSI C requires this to protect typedefs (the macro bug got fixed: see aother discussuion in this same forum). So when I'm about to call something whose interface might change (or be absent!), I grep the man page for #include strings and pop up the relevant .h file in another window/another editor. This usually contains something like #ifndef _BSD_PECULIAR_SHMOPS #define _BSD_PECULIAR_SHMOPS typedef struct shmop_t { ... } SHMOP; SHMOP *shmooze(struct time_t howlong); ... so I can can just copy the definition of shmooze() into the code I'm writing, along with the #ifndef, which gets its "n" deleted. And away we go. Of course, half the time I have to AMEND the #include files, but thats' another story... (:-{). -dave -- David Collier-Brown, | {toronto area...}lethe!dave 72 Abitibi Ave., | Joyce C-B: Willowdale, Ontario, | He's so smart he's dumb. CANADA. 223-8968 |