[comp.lang.c] Where is unix pre#defined? -- summary of responses.

flaps@utcsri.UUCP (05/09/87)

In article <4572@utcsri.UUCP> I (Alan J Rosenthal <flaps@utcsri.uucp>) wrote:
>Where is the pre-processor macro 'unix' pre#defined?
>Is this a Berkeleyism or can I use this to find out if I really am under
>unix or not?  Or alternatively, what other words are there?  Does System V
>#define unix?  Does version 7?

Responses were numerous and informative.  The basic answer is that all unix
compilers should #define unix.


Johan Vromans <mcvax!mhres!jv@seismo.uucp> wrote:
>*ALL* unix systems I have met had unix defined, except for
>Xenix systems. Most of them had additional defines to discriminate.
>
>"Normal" unix systems include Perkin-Elmer, National Semiconductor,
>NCR, Sperry, Harris, VAX/BSD4.[123], AT&T, SystemV/AT, Hewlett-Packard,
>Zilog, Gould, Burroughs, VAX/Nuxi, Sun.
>
>Xenix systems are Xenix 2, Xenix 3 and Xenix 5.


guy@sun.uucp (Guy Harris) wrote:
>"unix" is predefined by UNIX C implementations using the Reiser
>preprocessor, as long as somebody working on the implementation
>didn't screw up and remove it.  This preprocessor first appeared in
>V7; it is the basis of the 4BSD and S3/S5 C preprocessors.  I presume
>at least some UNIX C implementations not using the Reiser
>preprocessor also predefine "unix"; one hopes there are no UNIX C
>implementations that do not predefine "unix", although it is not
>inconceivable that somebody could be stupid enough to produce such an
>implementation.

After some correspondence he also added:

>Well, it looks like the S5R3 preprocessor will define "DMERT", rather
>than "unix", on the DMERT OS.  ("cpp" itself says "#if unix || DMERT"
>in several places.)  Then again, while DMERT is like UNIX, it's not
>clear whether you can say it is UNIX.


I also got helpful responses from iaoobel!wagner@unido.uucp (Juergen
Wagner), billj@zaphod.uucp (Bill Jones), and pegasus!hansen@ihnp4.uucp
(Tony Hansen).

-- 

Alan J Rosenthal

flaps@csri.toronto.edu, {seismo!utai or utzoo}!utcsri!flaps,
flaps@toronto on csnet, flaps at utorgpu on bitnet.

"Probably the best operating system in the world is the [operating system]
made for the PDP-11 by Bell Laboratories." - Ted Nelson, October 1977