pre#defines for system and machine

judah at mrevox.UUCP judah at mrevox.UUCP
Thu Jan 29 23:55:00 AEST 1987


While reading through the documentation of the "new make" from the AT&T
toolchest, I find that it comes with a modified version of "cpp" which
seems to address all the comments about "#defines" mentioned in the
latest string of notes.

To quote parts of the paper "The Fourth Generation Make" by
Glenn S. Fowler:

" ... The version of _cpp_ distributed with the _new_make_ also contains
some changes that improve makefile portability.  "#if" statements may use
the following builtin tests:
	exists(file) - Returns 1 if _file_ can be found using the #include
		search rules. ...
	...
Additional function predicates are defined by "#assert" statements in the
include file <default.h> which is automatically included by _cpp_ before the
first input file is read.  "#assert _predicate_(_value_)" makes
assertions that can be tested in "#if" expressions.  Such assertions are only
recognized within "#if" expressions and do not conflict with "#define"
variable expansions.  Most assertions deal with the current machine environment:
	system(_system-name_)
		Defines the operating system name.  Example values for
		_system-name_ are "unix" and "gcos".
	release(_system-release_)
		Defines the operating system release name.  Example values
		for _system-release_ are "apollo", "bsd", ...
	... "

These extensions to CPP would allow any level of specification of the
parentage of an operating system without having to resort to
"_sys_unix_sysV_5_0_" or other such monstrosities.
I am no expert on the fine points of C, but this proposal also looks
upwardly compatible with existing usage.
Anyone in a position to do so willing to propose this to the ANSI C committee?
(Or is the idea copyright by AT&T??)

Judah Greenblatt, Bell Communications Research, Morristown, NJ, USA
	(201)829-3059,  judah at flash.bellcore.com, ...!bellcore!flash!judah

P.S. Any other votes for adding "#elseif" to _cpp_??



More information about the Comp.lang.c mailing list