On 06/14/2018 01:25 PM, Liu Hao wrote:
> 在 2018年06月14日 18:49, Jacek Caban 写道:
>> On 06/14/2018 04:15 AM, Liu Hao wrote:
>>> 在 2018年06月14日 00:47, Jacek Caban 写道:
>>>> + __mingw_ovr
>>>> + int __cdecl _vscwprintf(const wchar_t * __restrict__ _Format, va_list
>>>> _ArgList)
>>>> + {
>>>> + int r =
>>>> __stdio_common_vswprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR,
>>>> NULL, 0, _Format, NULL, _ArgList);
>>> I suggest you change this to `_Result`, as explained quite a couple of
>>> months ago,
>> I don't recall it, sorry.
>>
>>> non-reserved identifiers other than those allowed by the
>>> standard should not be used inside standard headers.
>> What standard? Windows headers are full of argument identifiers like
>> that. For example 'p' and 'v' are very common for COM getters and
>> setters. Do you suggest to change that? For what reason? So that someone
>> may write
>> #define r
>> ?
> This is explained in [1], which is concluded from ISO/IEC 9899 (the ISO
> C standard). As for C++, which will be ISO/IEC 14882, double underscores
> occurring at any place in a identifier make it reserved, not necessarily
> at the beginning.
>
> You are right Windows headers have a number of non-reserved identifiers,
> as well as almost all 3rd-party ones. Notably, it is the reason why
> `#include <windows.h>` in public headers is discouraged.
>
> Pedantically speaking, Windows headers are out of ISO's scope and
> restrictions. So I am only sensitive to such problems in standard C
> headers, for example, <stdio> here.
>
> [1] http://en.cppreference.com/w/c/language/identifier#Reserved_identifiers
Sorry for the delay. That the attached patch look good?
Thanks,
Jacek
diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index 49c84e65..0dfb8705 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -1183,8 +1183,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti
__mingw_ovr
int __cdecl _vscwprintf(const wchar_t * __restrict__ _Format, va_list _ArgList)
{
- int r = __stdio_common_vswprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, NULL, 0, _Format, NULL, _ArgList);
- return r < 0 ? -1 : r;
+ int _r = __stdio_common_vswprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, NULL, 0, _Format, NULL, _ArgList);
+ return _r < 0 ? -1 : _r;
}
#else
_CRTIMP int __cdecl _scwprintf(const wchar_t * __restrict__ _Format,...);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public