[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] xanadu/remove-ISOC99_SOURCE-def
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] xanadu/remove-ISOC99_SOURCE-def |
Date: |
Sun, 22 May 2022 20:56:43 +0200 |
On Sun, 22 May 2022 15:45:30 +0000 Greg Chicares <gchicares@sbcglobal.net>
wrote:
GC> I haven't applied this:
GC>
GC> -// This selects a correct snprintf() for MinGW-w64.
GC> -
GC> -#if defined __GNUC__
GC> -# if !defined _ISOC99_SOURCE
GC> -# define _ISOC99_SOURCE
GC> -# endif // !defined _ISOC99_SOURCE
GC> -#endif // defined __GNUC__
GC>
GC> because, for the historical libmingwex at least,
GC> some macro such as _ISOC99_SOURCE was required to
GC> override a defective msvcrt snprintf(). IIRC, some
GC> other macros served the same purpose; this one
GC> seemed the least objectionable.
GC>
GC> Do you know for sure that the MinGW-w64 project
GC> has made that replacement unconditional?
No, they haven't, there is still a complicated conditional checking for,
among other things, _ISOC99_SOURCE, before defining __USE_MINGW_ANSI_STDIO
in _mingw.h (located in /usr/x86_64-w64-mingw32/include on Debian systems).
However this condition also contains the following subexpression:
|| (defined (__cplusplus) && __cplusplus >= 201103L && __MSVCRT_VERSION__
< 0xE00) \
which seems to indicate that it's not needed to enable MinGW own
implementation when using MSVC CRT >= 1400 (which will always be the case
nowadays), which has a (more) standard compliant snprintf() of its own.
I also hoped that if there were any problems with using that snprintf(),
they would be uncovered by the unit tests, notably snprintf_test.cpp, but
it passes without problems.
So I think it should be safe to remove it. BTW, if we you don't want to do
it, I think it would be better to predefine __USE_MINGW_ANSI_STDIO itself
(which wouldn't help the clang-tidy check, of course, but this is unrelated
to it) rather than doing it indirectly via _ISOC99_SOURCE.
Regards,
VZ
pgpGdntp7RgSq.pgp
Description: PGP signature
- [lmi] xanadu/remove-ISOC99_SOURCE-def, Greg Chicares, 2022/05/22
- Re: [lmi] xanadu/remove-ISOC99_SOURCE-def,
Vadim Zeitlin <=
- Re: [lmi] xanadu/remove-ISOC99_SOURCE-def, Greg Chicares, 2022/05/22
- Re: [lmi] xanadu/remove-ISOC99_SOURCE-def, Vadim Zeitlin, 2022/05/22
- Re: [lmi] xanadu/remove-ISOC99_SOURCE-def, Greg Chicares, 2022/05/22
- Re: [lmi] xanadu/remove-ISOC99_SOURCE-def, Vadim Zeitlin, 2022/05/23
- Re: [lmi] xanadu/remove-ISOC99_SOURCE-def, Greg Chicares, 2022/05/23
- Re: [lmi] clang-tidy checks (was: xanadu/remove-ISOC99_SOURCE-def), Vadim Zeitlin, 2022/05/23
- Re: [lmi] xanadu/remove-ISOC99_SOURCE-def, Greg Chicares, 2022/05/24