Web lists-archives.com

Re: Why is __unix__ defined, and not __WINDOWS__ ?




On Sun, 12 May 2019 20:22:36, 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?
> 
> 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.

????? (or: I dont quite follow your drift)

Henri

64-@@ x86_64-w64-mingw32-gcc -dM -E - < /dev/null | grep -i win
#define _WIN32 1
#define _WIN64 1
#define __WINT_MAX__ 0xffff
#define __WINT_MIN__ 0
#define __WIN32 1
#define __WIN64 1
#define __WINNT 1
#define __WINNT__ 1
#define __WIN32__ 1
#define __SIZEOF_WINT_T__ 2
#define WIN32 1
#define WIN64 1
#define __WINT_TYPE__ short unsigned int
#define __WINT_WIDTH__ 16
#define WINNT 1
#define __WIN64__ 1
64-@@ x86_64-w64-mingw32-g++ -dM -E -x c++ - < /dev/null | grep -i win
#define _WIN32 1
#define _WIN64 1
#define __WINT_MAX__ 0xffff
#define __WINT_MIN__ 0
#define __WIN32 1
#define __WIN64 1
#define __WINNT 1
#define __WINNT__ 1
#define __WIN32__ 1
#define __SIZEOF_WINT_T__ 2
#define WIN32 1
#define WIN64 1
#define __WINT_TYPE__ short unsigned int
#define __WINT_WIDTH__ 16
#define WINNT 1
#define __WIN64__ 1

=====


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