Subject: Re: #if defined(unix) (was Re: CVS commit: src)
To: enami tsugutomo <enami@sm.sony.co.jp>
From: Perry E. Metzger <perry@piermont.com>
List: tech-toolchain
Date: 08/31/1998 08:36:40
enami tsugutomo writes:
> Unfortunetly, this way doesn't work as expected, since cpp warns when
> a symbol is parsed (not when evaluated).

Note that the idea was to use short circuit evaluation so
defined(unix) could be used in

#if defined(__NetBSD__) || defined(unix)

> So, we needs another fix.  Probably, possible ways are:
> 
> (1) change cpp so that above trick works.

That's what I favor, because it means code will still compile on other 
platforms.

There are times, like the code in question, where #if defined(unix)
actually makes sense.

> (2) predefine __unix__ in cc (again) and test it.

Yeah, but no other OS uses __unix__ so what would the point be of
doing this instead of ripping the reference out?

> (3) test only __NetBSD__

If we can't do 1), 3) makes the most sense.

> Since that the meaning of that test is whether target system is unix
> variant (against vms or msdos) or not, probably (2) is better, isn't
> it?

No, because most traditional systems don't define __unix__

.pm