This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strange C++ function pointer test


On 31 December 2015 at 18:49, James Dennett <james.dennett@gmail.com> wrote:
> On Thu, Dec 31, 2015 at 4:42 AM, Jonathan Wakely <jwakely.gcc@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, but I
don't think doing it that way is the right fix for GNU/Linux anyway.
If we fix it in glibc we don't need that header.

>> This is already in Bugzilla:
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60401
>
>
> I don't see much information on that bug, beyond an assertion that this
> needs coordination with the underlying C library.  There's a reference to an
> e-mail thread, but there's little more information in the thread.

Is that a question? :-)

The point is just it's a known bug, not that Bugzilla contains all the
background.

> p.s. a tentatively ready DR indicates that the C++ headers should stop
> splitting the overloads for std::abs/::abs up, so that if you include either
> cmath or cstdlib (or the deprecated/C compatibility headers) you get the
> full overload set.  That seems the only way, short of a warning like
> Clang's, to ensure that people write correct code when they use abs().

Yup.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]