Why is __unix__ defined, and not __WINDOWS__ ?

Agner Fog agner@agner.org
Mon May 13 04:12:00 GMT 2019


But the compiler generates a Windows executable following most of the 
Windows ABI (object file format, calling convention, etc.)


On 12/05/2019 21.53, Hans-Bernhard Bröker wrote:
> Am 12.05.2019 um 20:22 schrieb Agner Fog:
>
>> 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?
> Because it's correct that way.  Cygwin runs on Windows, but it _is_ not
> Windows.
>
>> A C/C++ program will check for these macros if it wants to know which
>> operating system you are compiling for, and this will give the wrong
>> result.
> No.  It gives the correct result.
>
> --
> 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
>
>

--
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



More information about the Cygwin mailing list