Subject: toolchain/19364: cc/c++ does not define unix symbol internally
To: None <>
From: None <>
List: netbsd-bugs
Date: 12/12/2002 02:45:10
>Number:         19364
>Category:       toolchain
>Synopsis:       cc/c++ does not define unix symbol internally
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    toolchain-manager
>State:          open
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 12 02:46:00 PST 2002
>Originator:     Darren Reed
>Release:        NetBSD 1.6G
NetBSD excalibur 1.6G NetBSD 1.6G (GE) #10: Sun Sep  8 01:12:22 EST 2002     darrenr@excalibur:/usr/src/sys/arch/i386/compile/GE i386

Neither c++ or cc define any generic unix symbols in the macro namespace.  On other platforms, "unix" is generally defined.  This makes writing portable code between Un*x and Windows platforms more difficult if NetBSD is to be considered a target platform and that leads to the obvious suggestion that not using NetBSD is a solution.

On other platforms, "unix" is always defined by the compiler (Sun's Forte compiler suite, gcc/g++ on linux, etc) and in some cases other unix related symbols will be defined (__unix, __unix__) but this is not nearly as universal as "unix".

Try to write portable code between NetBSD, other Unixes and Windows and use #ifdef unix.

Do not use NetBSD is one solution but the submitter would prefer to not to have to adopt that solution.  Nor is the submmitter keen on having to pollute code with NetBSD specific #ifdef's because it doesn't think it's unix.