nfs1165@dsacg3.dsac.dla.mil ( James L Strickland) (08/24/90)
Thanks to all of you who sent me mail about how to identify the predefined variables associated with C compilers. The overwhelming consensus is to do "strings /lib/cpp" and search the output for likely candidates. Put the candidates into a *.c file and run "cc -E foo.c" to determine the values for the variables. -- James Strickland - Systems Programmer jstrickland@dsac.dla.mil Defense Logistics Agency Systems Automation Center (DSAC) Office of Information System Facilities, AIS Software Division, Distributed Systems (FSD) (614) 238-9649 AV 850-9649
merlyn@iwarp.intel.com (Randal Schwartz) (08/25/90)
In article <2423@dsacg3.dsac.dla.mil>, nfs1165@dsacg3 ( James L Strickland) writes: | Thanks to all of you who sent me mail about how to identify | the predefined variables associated with C compilers. | | The overwhelming consensus is to do "strings /lib/cpp" and | search the output for likely candidates. Put the candidates | into a *.c file and run "cc -E foo.c" to determine the values | for the variables. Here's what does it for me, all at once (no Perl required :-): #!/bin/sh strings -2 /lib/cpp | sort -u | awk '/^[a-zA-Z_][a-zA-Z0-9_]*$/ { print "#ifdef " $0 "\n__" $0 "\n#endif" }' | /lib/cpp | sed -n 's/^__//p' Here's the output on a sun4/490 running SunOS4.1: __BUILTIN_VA_ARG_INCR __FILE__ __LINE__ sparc sun unix And here's the output of the same script on a microvax running (ancient) Ultrix2.3: __FILE__ __LINE__ bsd4_2 ultrix unix vax Just another UNIX hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/