RFR: JDK-8285730: unify _WIN32_WINNT settings [v4]
Matthias Baesken
mbaesken at openjdk.java.net
Fri May 6 07:36:48 UTC 2022
On Wed, 4 May 2022 09:08:28 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:
> Does this mean that not setting _WIN32_WINNT means :any API is allowed" ?
Hi David , I did one more try with my current setup (VS2017 on a Win10 notebook). I did not set _WIN32_WINNT.
My little test program
#include <windows.h>
#include <stdio.h>
int main() {
#ifdef _WIN32_WINNT
printf("_WIN32_WINNT is defined .\n");
#if (_WIN32_WINNT == 0x0600)
printf("Vista API setting\n");
#endif
#if (_WIN32_WINNT == 0x0601)
printf("Win 7 API setting\n");
#endif
#if (_WIN32_WINNT == 0x0602)
printf("Win 8 API setting\n");
#endif
#if (_WIN32_WINNT == 0x0603)
printf("Win 8.1 API setting\n");
#endif
#if (_WIN32_WINNT == 0x0A00)
printf("Win 10 API setting\n");
#endif
#endif
return 0;
}
shows me
_WIN32_WINNT is defined .
Win 10 API setting
So I think with our current compilers in use like VS2017 / VS2019 we allow Win10 APIs in most of our code except a few places where we set _WIN32_WINNT and go back to some mixture of older APIs.
Not sure if this is a good thing, we could break for example Win 8.1/Win2012 compatibility easily this way.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8428
More information about the nio-dev
mailing list