[PATCH v2] Implement C23 memalignment

Joseph Myers josmyers@redhat.com
Fri Oct 10 14:40:26 GMT 2025


On Fri, 10 Oct 2025, Florian Weimer wrote:

> * Joseph Myers:
> 
> > Add the C23 memalignment function (query the alignment of a pointer)
> > to glibc.
> >
> > Given how simple this operation is, it would make sense for compilers
> > to inline calls to this function, but I'm treating that as a compiler
> > matter (compilers should add it as a built-in function) rather than
> > adding an inline version to glibc headers (although such an inline
> > version would be reasonable as well).  I've filed
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122117 for this feature
> > in GCC.
> 
> Should this function be added to libc_nonshared.a until the standard is
> released, in case its definition changes in subsequent drafts?

This function is from C23, not C2y.  And that's not what we've done before 
with features in draft standards either; instead, we've added compat 
symbols as needed in the case of sufficiently incompatible changes done 
after a feature appeared in a release (which we'll need to do with the 
renaming of uimaxabs to umaxabs).  Using libc_nonshared.a also means using 
different license notices.

We could maybe consider a compatibility policy more like libstdc++'s for 
features from unreleased drafts (though if we did that, I think we would 
at least need to clearly mark the features as experimental and subject to 
change in the manual and NEWS at the point where we add them).

-- 
Joseph S. Myers
josmyers@redhat.com



More information about the Libc-alpha mailing list