This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 64 bit Cygwin target and _WIN64


On Jul 18 18:15, Peter Rosin wrote:
> On 2012-07-18 14:55, Corinna Vinschen wrote:
> > On the other hand, an application which provides Windows and POSIX
> > functions will test for _WIN32 with a high probability:
> > 
> > #ifdef _WIN32
> > #ifdef _WIN64
> > call foo_win64
> > #else
> > call foo_win32
> > #endif
> > #else
> > call foo_posix
> > #endif
> 
> Some would perhaps write that as:
> 
> #if defiend _WIN64
> call foo_win64
> #elif defined _WIN32
> call foo_win32
> #else
> call foo_posix
> #endif

Yes, that's the possible danger.  But still, the chance that the Windows
headers are included guarded by an #ifdef _WIN32 are extremly high.  If
so, the _WIN64 will not be defined when compiling the code, considering
solution 3.  The chance to meet such an application seems to be pretty
low.

I had a more or less sleepless night thinking about this stuff, but the
more I think about it, the more I think that just #defining _WIN64 in
the Windows headers if called from a x86_64-targeting Cygwin compiler is
the right thing to do.  On one hand a 64 bit Cygwin application will
get the correct Windows definitions, on the other hand the impact on the
Mingw64 headers is minimal.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]