Implement C23 memset_explicit (bug 32378)

Florian Weimer fweimer@redhat.com
Tue Sep 30 18:39:43 GMT 2025


* Paul Eggert:

> On 2025-09-30 08:33, Joseph Myers wrote:
>> If the user is using GCC 15 or later (or any compiler defaulting to C23 or
>> a later language version), C23 functions*will* be visible by default
>
> Yes, good point, so the question here isn't about GCC 15; it's about
> older GCCs and non-GCCs that do not claim conformance to C23. That's
> an important set of use cases even today, and making memset_explicit
> visible would be useful for these cases.

But this is actually a compelling reason to use __USE_MISC: An upstream
developer using GCC 15 might not use _GNU_SOURCE because there is no
error.  But when someone uses GCC 13 or earlier to compile the sources
and we don't use __USE_MISC in the header, GCC will provide an implicit
function declaration.  This could introduce subtle bugs (depending on
the ABI for implicit function declarations).  With __USE_MISC, that
happens only if the programmer uses _ISOC11_SOURCE or similar.
(Typically, -std=c17 or similar would come from upstream, and encounter
errors with GCC 14 or later in upstream, so that is covered as well.)

Thanks,
Florian



More information about the Libc-alpha mailing list