https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107795

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Louis Dionne from comment #4)
> Yeah but we may need to add stuff to <limits.h> on some platforms, so we may
> need to have such a header. Also, I assume you only do that for a subset of
> headers, because you must have <foo.h> headers in libstdc++ for a few
> headers that require adding const-correct overloads of e.g. `memchr`?

No, we get those overloads from libc (or we don't get them at all).

Sensible libc implementations provide the correct overloads for C++ nowadays,
e.g. glibc:

#ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
extern "C++"
{
extern char *strchr (char *__s, int __c)
     __THROW __asm ("strchr") __attribute_pure__ __nonnull ((1));
extern const char *strchr (const char *__s, int __c)
     __THROW __asm ("strchr") __attribute_pure__ __nonnull ((1));


Solaris:

#else /* __cplusplus >= 199711L */
extern void *memchr(const void *, int, size_t);
extern char *strchr(const char *, int);

AIX:

#ifdef __cplusplus98__interface__
        extern const char       *strchr(const char *, int);
        extern char             *strchr(      char *, int);


If even AIX libc can do it, anybody can do it.

Reply via email to