On 2 January 2016 at 11:42, Jonathan Wakely wrote:
> On 31 December 2015 at 18:49, James Dennett <james.denn...@gmail.com> wrote:
>> On Thu, Dec 31, 2015 at 4:42 AM, Jonathan Wakely <jwakely....@gmail.com>
>> wrote:
>>>
>>> On 31 December 2015 at 11:54, Dominik Vogt wrote:
>>> > Is there a requirement for a certain minimum Glibc version for
>>> > this to work?
>>>
>>> It doesn't work with any glibc, because it doesn't declare the C++
>>> overloads.
>>>
>>> Libstdc++ has an include/c_compatibility/math.h header that would
>>> include <cmath> (which declares the C++ overloads) and then pull them
>>> into the global namespace, but that isn't used on GNU/Linux, and would
>>> create other problems.
>>>
>>
>> What other problems?
>>
>> It's something of an assumption of the C++ Standard that it's practical for
>> C++ implementations to provide such wrappers to add overloads for C++.  If
>> that's causing some fundamental problem then we should document it (and
>> ideally address it).
>
> Not fundamental problems in the standard, just with the implementation
> of that header. It won't work as is and would need changes

Specifically, that header assumes that <cmath> is include/c/cmath, but
for GNU/Linux we use include/c_global/cmath, and IIUC it assumes that
the libc header defines some of the C++ overloads (but not all?),
which isn't true for glibc.

So the combination of include/c/cmath and
include/c_compatibility/math.h wouldn't work. We could change it to
work, but that might break targets using those headers already
(possibly just QNX? I don't know).

If we want to fix it in libstdc++ then I think we need a different
math.h, written from scratch, not starting from
include/c+compatibility/math.h

Reply via email to