This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Why is __unix__ defined, and not __WINDOWS__ ?
- From: "Mike Gran via cygwin" <cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Sun, 12 May 2019 13:33:30 -0700
- Subject: Re: Why is __unix__ defined, and not __WINDOWS__ ?
- References: <5fbb6229-da17-c056-19b9-9819c684a8ad@agner.org>
- Reply-to: Mike Gran <spk121 at yahoo dot com>
On Sun, May 12, 2019 at 08:22:36PM +0200, Agner Fog wrote:
> I have noticed that the gcc and clang compilers have defined the
> preprocessing macro __unix__, but not __WINDOWS__, _WIN32, or _WIN64 when
> compiling a windows executable.
>
> Why is this?
As I understand it, when using the cygwin compiler to compile for the
cygwin target, these defines are intentionally not defined, because
Cygwin is supposed to look and feel like a Posix platform, not a
windows one.
The various MinGW compilers do define these constants because the target
is native windows.
I think these days the canonical defines are (somebody correct me if
I'm wrong)
__CYGWIN__ for Cygwin
_WIN32 as 1 on MinGW when the compilation target is Windows 32-bit
ARM, 64-bit ARM, x86, or x64. Otherwise, undefined.
_WIN64 as 1 on MinGW when the compilation target is Windows 64-bit
ARM or x64. Otherwise, undefined
I am not a maintainer.
-
Mike Gran
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple