有什么便携式方法可以检查是否malloc分配非零内存块失败?
malloc
根据单一 Unix 规范 http://pubs.opengroup.org/onlinepubs/007908799/xsh/malloc.html, malloc将返回NULL并设置errno当它失败时。
NULL
errno