Next: mblen
, Previous: lstat
, Up: ISO C and POSIX Function Substitutes [Contents][Index]
malloc
POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html
Gnulib module: malloc-posix
Portability problems fixed by Gnulib:
errno
to ENOMEM
on
some platforms:
mingw, MSVC 14.
malloc (n)
can succeed even if n
exceeds PTRDIFF_MAX
. Although this behavior is arguably
allowed by POSIX it can lead to behavior not defined by POSIX later,
so malloc-posix
does not allow going over the limit.
Extension: Gnulib provides a module ‘malloc-gnu’ that substitutes a
malloc
implementation that behaves more like the glibc implementation,
by fixing this portability problem:
malloc (0)
returns NULL
on success on some platforms:
AIX 7.2.