B
Bartc
And note 176 is:
Which I believe means that,
errno = 0;
p = malloc(n);
if(errno) /* p equals NULL */
And,
errno = 0;
p = malloc(n);
if(p == NULL) /* errno is non-zero */
It says errno *may* be set to nonzero by a library function whose docs do
not mention errrno.
This implies it is optional. And since there appears to be some confusion
about this, a programmer would have to be out of his mind to rely on errno
for checking the result of malloc instead of a NULL pointer return (apart
from the pita of having to set errno beforehand).
The only benefit of errno, if it was guaranteed to be set by malloc, would
be the ability to do a whole series of mallocs then check for error at the
end.