[PATCH] Enable libstdc++ numeric conversions on Cygwin

Jennifer Yao jenny.hyphen.fa@gmail.com
Thu Nov 12 17:25:00 GMT 2015


> On 12/11/15 13:39 +0000, Jonathan Wakely wrote:
>>
>> One downside of this change is that we introduce some (hopefully safe)
>> ODR violations, where inline functions and templates that depend on
>> _GLIBCXX_USE_C99_FOO might now be defined differently in C++98 and
>> C++11 code. Previously they had the same definition, even though in
>> C++11 mode the value of the _GLIBCXX_USE_C99_FOO macro might have been
>> sub-optimal (i.e. the C99 features were usable, but the macro said
>> they weren't). Those ODR violatiosn could be avoided if needed, by
>> always using the _GLIBCXX98_USE_C99_FOO macro in code that can be
>> included from either C++98 or C++11. We could still use the
>> _GLIBCXX11_USE_C99_FOO macro in pure C++11 code (such as the numeric
>> conversion functions) and get most of the benefit of this change.
>
>
> This patch (relative to the previous one) would avoid the ODR
> problems, by only using the C++98 macro in code that gets used in
> C++98 and later, and using the _GLIBCXX11_XXX ones in code that is
> never compiled as C++98 (specifically, the numeric conversion
> functions).
>
> Maybe this is a safer, more conservative change.

I haven't tested either of your patches yet (the testsuite runs
reeeeally slowly on Cygwin T___T), but I just wanted to express my
approval of the proposed changes (more specifically, the second patch
you posted).

Also, I was not aware that we had to worry about C++03 compatibility.
Sounds tedious.



More information about the Gcc-patches mailing list