Comment by spiffyk

Comment by spiffyk 2 days ago

1 reply

From `malloc(3)`:

   Nonportable behavior
       The  behavior of these functions when the requested size is zero is glibc specific; other implementations may return NULL without setting errno, and portable POSIX programs should tolerate such behavior.  See realloc(3p).

       POSIX requires memory allocators to set errno upon failure.  However, the C standard does not require this, and applications portable to non-POSIX platforms should not assume this.
anymouse123456 2 days ago

As someone writing C for POSIX and embedded environments, this clarification is a super helpful.