[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: _WIN32 and __CYGWIN__
From: |
Bruno Haible |
Subject: |
Re: _WIN32 and __CYGWIN__ |
Date: |
Wed, 29 Aug 2018 18:07:27 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-130-generic; KDE/5.18.0; x86_64; ; ) |
Hi Ken,
> There's a lot of code in gnulib that contains 'defined _WIN32 && !
> defined __CYGWIN__'.
Yes.
> The '! defined __CYGWIN__' part is redundant,
> because _WIN32 is never defined on Cygwin.
No. _WIN32 is not defined _by_default_ on Cygwin. But users can use
"gcc -D_WIN32", when they want to access native Windows APIs (for
whatever reason).
gnulib doesn't control what kind of -D options are given when a package
that contains some gnulib source files is compiled. Yet, the expectation
is that it produces the same code with "gcc -D_WIN32" as with plain "gcc".
> I think the presence of a redundant '! defined __CYGWIN__' is confusing to
> people who read the code.
I disagree. Given that Cygwin always runs on Windows, people who read the
code might be confused about what the macro '_WIN32' means. So the
'! defined __CYGWIN__' actually clarifies things.
It might be clearer if we had a file that explains the correspondence
between platforms, config.guess triples, and predefined macros (sort of
a summary of predef.sourceforge.net). But we don't have such a file yet.
Bruno