Implement C23 const-preserving standard library macros

Joseph Myers josmyers@redhat.com
Mon Jan 19 17:17:20 GMT 2026


On Mon, 19 Jan 2026, Florian Weimer wrote:

> * Andreas Schwab:
> 
> > On Nov 18 2025, Joseph Myers wrote:
> >
> >> C23 makes various standard library functions, that return a pointer
> >> into an input array, into macros that return a pointer to const when
> >> the relevant argument passed to the macro is a pointer to const.
> >
> > Shouldn't this be disabled when compiling with -std=gnu17?
> 
> Siddhesh and I discussed this for a bit.
> 
> They should be disabled for !__STRICT_ANSI__, which includes -std=gnu17.

That sounds very questionable to me.  If someone uses -std=gnu23 (or has 
it on by default with GCC >= 15), or -std=gnu17 -D_ISOC23_SOURCE or 
-std=gnu17 -D_GNU_SOURCE, etc., I'd expect them to get C23 features of the 
form "extra type checking" just like those of the form "new functions".

-- 
Joseph S. Myers
josmyers@redhat.com



More information about the Libc-alpha mailing list