Why is _WIN64 not defined as 1 in _cygwin.h?

Z. Majeed zmajeed@sbcglobal.net
Thu Nov 25 18:06:24 GMT 2021


Thanks for clearing that up - I'll send a patch to mingw-w64-public

The porting tip is appreciated - luckily the need for Win32 in the port has been minimal - it may be obviated completely if I can add VmPeak support - and take care of the other issue - a VmSize number that does not match Win32 PagefileUsage

 On Thursday, November 25, 2021, 08:08:24 AM EST, Corinna Vinschen <corinna-cygwin@cygwin.com> wrote:

On Nov 24 14:17, Z. Majeed wrote:
> /* _WIN64 is defined by the compiler specs when targeting Windows. 
>  The Cygwin-targeting gcc does not define it by default, same as 
>  with _WIN32.  Therefore we set it here.  The result is that _WIN64 
>  is only defined if Windows headers are included. */#ifdef
> __x86_64__#define _WIN64#endif This gives compile errors wherever
> _WIN64 is used in oneTBB code in expressions like #if _WIN32 || _WIN64
> e.g. at
> https://github.com/oneapi-src/oneTBB/blob/master/test/tbbmalloc/test_malloc_compliance.cpp#L38
> The _WIN64 predefined macro is documented at
> https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
> "_WIN64 Defined as 1 when the compilation target is 64-bit ARM or x64.
> Otherwise, undefined." Why has cygwin chosen to define _WIN64 with no
> value?

Because it was sufficient at the time and nobody actually cared until
today, I guess.

As for mixing Cygwin and Windows calls, I'd like to point out
https://cygwin.com/faq.html#faq.programming.64bitporting

Not saying you did something wrong, but the fact that the long datatype
differs in size requires some careful checking when porting stuff.



> Can _WIN64 instead be defined as 1 per Microsoft specification?


Note that this is just the Cygwin-specific part of the mingw-w64
project, not Cygwin itself.  If you want to change that, just send a
patch to the mingw-w64 mailing list.


Corinna



More information about the Cygwin-developers mailing list