c - Does posix_memalign() sets the pointer to NULL on fail? -
int posix_memalign(void **memptr, size_t alignment, size_t size);
allocate size
bytes aligned on alignment
. returns 0 on success , errno on fail.
is *memptr
set 0 on fail?
it may do, not guaranteed to.
see the specification simply says:
upon successful completion, posix_memalign()
shall homecoming zero; otherwise, error number shall returned indicate error.
it says nil happens *memptr
on error, read state undefined. 2 sane behaviours 0, or leave is, cannot rely on that.
c
No comments:
Post a Comment