Path: utzoo!utgpu!watmath!att!ucbvax!SNOW-WHITE.MERIT-TECH.COM!goss From: goss@SNOW-WHITE.MERIT-TECH.COM (Mike Goss) Newsgroups: comp.sys.sgi Subject: Re: cpp reserved symbols Message-ID: <8908091450.AA05860@snow-white.merit-tech.com> Date: 9 Aug 89 14:50:50 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 45 Regarding the message: > From: Alan Davis> Message-Id: <8908091305.AA01742@masig2.ocean.fsu.edu> > Subject: cpp reserved symbols > I have been trying to compile a software package from a 3rd party which was > designed to run on various machines including VAXes. In the C code they have > inserted #ifdef vax || #ifdef vms cpp directives (amongst others) so the code > could be ported to various machines. I was under the impression that these > were reserved symbols that had already been defined to cpp ( 3xxx IRIS, > running 3.6). However I have just found out that vms and vax are NOT defined, > contrary to the misleading statement in the cpp man page, which states upon > closer inspection "The current list of these possibly reserved symbols > includes:". Does any one have a complete list of "possibly reserved symbols" > that ARE currently defined? It has been my experience that every C compiler vendor defines their own set of symbols that you can test to see if you are using their compiler or CPU. The "#ifdef" ("#ifndef") directives test whether the symbol is (is not) defined. This is handy since C is not quite portable, and also since the operating system is not always UNIX, and may not support UNIX compatible system calls. The VAX/VMS C compiler defines the symbols "VMS" and "VAX" to allow you to test whether you are using the VMS operating system and a VAX, respectively. These symbols should not (in theory) be defined on any other machine. Most UNIX C compilers define the symbol "unix" and/or "UNIX" to allow you to test for the UNIX operating system. On MS-DOS, Microsoft C defines the symbols "MSC" and "MSDOS" to allow tests for this specific compiler and operating system. Most compilers also allow tests for CPU type, as well. On the MIPS systems (SGI 4D included), the preprocessor defines the symbol "mips". On some Motorola 68000 based systems, the symbol "M68000" is defined. Unfortunately, there is no standard for these symbols. Also, most compiler manuals bury this information somewhere in the depths of the appendices or worse, making it hard to track down. I've often wished that C compilers had some option which would cause the preprocessor to spew out a list of all the predefined symbols. Mike Goss Merit Technology Inc.