[comp.lang.c] Preprocessor Portability

chip@killer.UUCP (Chip Rosenthal) (11/04/87)

A question on cpp:  how portable are "#elif" and "defined()"?  Although
they aren't in K&R, I don't recall working on a system which doesn't
have them.
-- 
Chip Rosenthal, Dallas Semiconductor, (214) 450-0400
This message courtesy of ``The UNIX Connection BBS'' in Dallas.
Neither they nor my employer are responsible for my stupidity.

guy@gorodish.Sun.COM (Guy Harris) (11/06/87)

> A question on cpp:  how portable are "#elif" and "defined()"?  Although
> they aren't in K&R, I don't recall working on a system which doesn't
> have them.

Most C compilers using the Reiser "cpp", prior to the System V Release 3 C
compiler, do not have "#elif"; this means V7, System III, System V "Release 1"
and Release 2, and 4.[123]BSD.  Doug Gwyn has posted patches to put "#elif"
into older "cpp"s, but I suspect most systems out there do *not* have "#elif".

Most, if not all, C compilers with using the Reiser "cpp" have "defined()";
this means most UNIX C compilers will have it.

I can't speak for compilers not using the Reiser "cpp".

The current ANSI C draft specifies both, so all ANSI C-conformant C compilers
will have them unless they disappear in a future draft.
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com

gwyn@brl-smoke.UUCP (11/12/87)

In article <1986@killer.UUCP> chip@killer.UUCP (Chip Rosenthal) writes:
-A question on cpp:  how portable are "#elif" and "defined()"?  Although
-they aren't in K&R, I don't recall working on a system which doesn't
-have them.

#elif was not supported in 4.2BSD nor UNIX System V Release 2.0.