[PATCH] Define 3-argument overloads of std::hypot for C++17 (P0030R1)

Jonathan Wakely jwakely@redhat.com
Thu Sep 29 13:26:00 GMT 2016


On 29/09/16 13:12 +0100, Jonathan Wakely wrote:
>On 29/09/16 14:02 +0200, Rainer Orth wrote:
>>Hi Jonathan,
>>
>>>>If only there was some way the Solaris team could contact us so we
>>>>could coordinate and stop adding more and more hacks to mess with each
>>>>others headers. But I assume they don't have access to the www or
>>>>email, because the only other explanation is too rude to say on a
>>>>public list.
>>>
>>>Presumably they now provide all the declarations for C++11, so we
>>>don't need to declare them. Moving the new hypot overload outside the
>>
>>still this doesn't need into <math.h>, but into libstdc++ configury
>>IMNSHO.
>
>I agree. Presumably they wanted their updated headers to work with
>existing GCC releases, and not have to wait until we modified our
>configury to cooperate with their changes.
>
>But if they simply communicated with us we could plan for that kind of
>thing in advance, and ensure we don't keep trying to fix each others
>headers from a distance.
>
>>>_GLIBCXX_USE_C99_MATH_TR1 block should mean it's declared. That will
>>>break when Solaris adds C++17 support, so we'd better add some macro
>>>to guard the new hypot overloads, so they can be disabled again. Let's
>>>call it __CORRECT_ISO_CPP17_MATH_H_PROTO (and maybe add a coment like
>>>"Dear Solaris team, ...").
>>
>>... which assumes they do read this ;-)
>
>Indeed.
>
>Since they seem to be adding declarations to <math.h> and only in the
>global namespace, and the 3-argument form doesn't exist in the global
>namespace, maybe we can assume they aren't going to add it to
><math.h>.
>
>
>>>Does this work?
>>
>>It does indeed, at least running the single testcase with runtest now
>>passes.
>
>Thanks, I'll commit that soon.

Herre's what I committed, without a CORRECT_ISO_CPP17_MATH_H_PROTO
macro check (which I'd put in the wrong place anyway :-)

Tested powerpc64le-linux, committed to trunk.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 3421 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20160929/f575a32e/attachment.bin>


More information about the Libstdc++ mailing list