Implement C23 memset_explicit (bug 32378)

Collin Funk collin.funk1@gmail.com
Fri Sep 26 20:36:17 GMT 2025


Joseph Myers <josmyers@redhat.com> writes:

> On Fri, 26 Sep 2025, Paul Eggert wrote:
>
>> On 2025-09-26 12:39, Joseph Myers wrote:
>> > Although the function is only declared here for __GLIBC_USE (ISOC23),
>> > there's a reasonable argument for making it more widely available by
>> > inclusion in __USE_MISC.
>> 
>> If I'm reading the source code correctly, FreeBSD makes memset_visible in
>> <string.h> by default; you must define a strict-conformance-to-old-standards
>> macro like _ANSI_SOURCE, _C99_SOURCE or _C11_SOURCE to make it vanish.
>> 
>> Shouldn't we do something similar? I'm not seeing the point of being shy here.
>
> That's a key question for review of this patch.  Should it be visible for 
> __USE_MISC as well as __GLIBC_USE (ISOC23)?

My thinking is that we should use __USE_MISC if the C23 function was
based on an existing implementation of the function. If it was first
introduced by the C23 standard, not an existing extension, then I think
__GLIBC_USE (ISOC23) makes more sense.

I'll review the patch later though and take some time to think about
that.

Thanks for the clarification on the Clang issue, BTW.

Collin


More information about the Libc-alpha mailing list