HomeFreeBSD

lib/libc: implement C23 memalignment()

Description

lib/libc: implement C23 memalignment()

This new function computes the alignment of a pointer.
It is part of ISO/IEC 9899:2024, the new C standard.
If the pointer is a null pointer, null is returned.
I have tried to write an implementation that can cope
with traditional address-based architectures, even if
size_t and uintptr_t are of different length. Adjustments
may be needed for CHERI though.

A man page is provided, too. No unit test for now.

Reviewed by: kib, imp, ziaee (manpages), pauamma@gundo.com
Approved by: markj (mentor)
MFC after: 1 month
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D53673

Details

Provenance
fuzAuthored on Nov 10 2025, 5:54 PM
Reviewer
kib
Differential Revision
D53673: lib/libc: implement C23 memalignment()
Parents
rG4ab2d625e146: nuageinit.7: fix cloud-config header line
Branches
Unknown
Tags
Unknown