New cpp predefines for POSIX/ANSI C

Jim Gardner jagardner at watmath.waterloo.edu
Sat Feb 25 03:49:56 AEST 1989


[...]

Our group at the University of Waterloo maintains a number
of C compilers, and we have found the following scheme useful.

We have two classes of definitions: machines and operating systems.
This copes with the problem of machines that support several
operating systems (e.g. PORT, DOS, XENIX on the PC) or operating
systems that run on many different machines (UNIX on many kinds
of hardware).

We further differentiate between the HOST system (where the program
is being compiled) and the TARGET system (where the program will
run).  This takes care of problems that may arise during cross-compilation.

As a result, we have four sets of manifests, each beginning with
a different prefix:

	_TS_   target operating system
	_TM_   target machine
	_HS_   host operating system
	_HM_   host machine

This gives us a set of definitions like:

	_TS_UNIX
	_TM_I80286
	_TS_GCOS8_NS
	_TS_GCOS8_SS
	/* etc. */

By the way, I put in the last examples to point out that "__gcos" is
not a good name.  Off the top of my head, I can think of GCOS-III
(which ran an old Bell C compiler), GCOS-6 (runs on Bull DPS-6 minis),
GCOS-7 (runs on Bull DPS-7 mainframes, and utterly different from
any other operating system I've ever seen), and GCOS-8 (running on
Bull DPS-8, DPS-8000, DPS-88, and DPS-90 machines, in two different
modes that have entirely different sets of service calls).  Bull
calls all its operating systems GCOS, despite vast differences between
them.

		Jim Gardner, University of Waterloo



More information about the Comp.std.c mailing list