malloc ¶POSIX specification:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/malloc.html
Portability problems fixed by Gnulib:
errno:
mingw, MSVC 14.
errno
to EAGAIN instead of to ENOMEM. Although POSIX allows
EAGAIN, the malloc-posix module insists on ENOMEM
which also conforms to POSIX and is GNU-compatible:
Solaris 11.4.
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.3.