Skip site navigation (1)Skip section navigation (2)

  
 
  

home | help
MEMALIGNMENT(3) 	     Library Functions Manual		 MEMALIGNMENT(3)

NAME
     memalignment -- find the memory alignment of an object

SYNOPSIS
     Standard C Library (libc, -lc) #include <stdlib.h>

     size_t
     memalignment(const void *ptr);

DESCRIPTION
     The  memalignment() function determines the alignment of the object pointed
     to by ptr.  This alignment is a power of 2, and  may  be  larger  than  the
     range  supported  by  the alignof operator.  The value returned can be com-
     pared to the result of alignof, and if it is greater or equal,  the  align-
     ment requirement of the operand is satisfied.

RETURN VALUES
     Returns the alignment of ptr as a power of 2.  If ptr is a null pointer, an
     alignment	of  zero  is  returned.  An alignment of zero indicates that the
     tested pointer cannot be used to access an object of any type.

SEE ALSO
     aligned_alloc(3), posix_memalign(3)

STANDARDS
     The memalignment() function conforms to ISO/IEC 9899:2024 ("ISO C23").

HISTORY
     The memalignment() function was added in FreeBSD 15.1.

AUTHOR
     Robert Clausecker <fuz@FreeBSD.org>

FreeBSD 15.1			November 10, 2025		 MEMALIGNMENT(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=memalignment&sektion=3&manpath=FreeBSD+15.1-RELEASE+and+Ports.quarterly>

home | help