Keith Marshall
keith****@users*****
Sat Jun 30 04:14:32 JST 2018
On 29/06/18 15:18, Earnie wrote: >> Would anyone care to propose a test case for such version specific >> support? I no longer use Windows for any daily purpose, but I do >> still have the ability to test compatibility for WinXP and Win7, >> running either as a virtual machine. Would anyone else be able to >> assist with testing on other (esp. legacy) Windows versions? > > The 2nd example from > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setmode > should suffice for a test case. Not a particularly good one, since it doesn't specify a deterministically measurable result. Indeed, it isn't even a particularly good example, since it fails to check the return from _setmode() for a possible error. If I make the _O_U16TEXT, _O_U8TEXT, and _O_WTEXT constants unconditionally visible, in <fcntl.h>, and then compile this so called example as-is, and then run it on WinXP, I see absolutely no output at all; on Win7, it produces an indecipherable rake of "?" glyphs. If I add a check on the return value from _setmode(), I can see that, on WinXP, an untrapped invalid parameter exception was raised. > However, I don't have any existence of any version of Windows less > than 10. So, you could confirm support on Win10 only; that's likely to be okay, since it already appears to be supported on Win7, but not on WinXP, (and almost certainly not on any version preceding WinXP); what we're mostly lacking, here, is confirmation of whether the support which appears in Win7 was introduced in Vista, or in Win7 itself. (Of course, confirmation that the assumption of continuing support in the successors to Win7 would also be useful). > My assumption here is that since this affects the standard API set > such as _setmode then support for these exists in the delivered > MSVCRT.DLL for all newer OS versions. That seems to be a reasonable assumption; of course, as I've just indicated above, confirmation would be useful. > Therefore the __MSVCRT_VERSION__ macro is not the correct guard and > _WIN32_WINNT macro should be used. Since Danny Smith added the <fcntl.h> defines, in 2007, with the __MSVCRT_VERSION__ >= 0x0800 guard in place, it's likely that he knew that the support was present in MSVCR80.DLL and later; however, his ChangeLog comment suggests an addition for Vista, for which a better guard would be: #if _WIN32_WINNT >= _WIN32_WINNT_VISTA but perhaps both are applicable, in which case the correct guard is the OR combination of both. > However, that would mean as distributed, we would only support > _WIN32_WINNT > VISTA as the build would require it. And that would be a great shame; much better, surely, would be to test for support, at run time, and adapt behaviour accordingly. -- Regards, Keith. Public key available from keys.gnupg.net Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature Url : https://lists.osdn.me/mailman/archives/mingw-users/attachments/20180629/231a1d88/attachment-0001.pgp