2 ms·
There has been a lot of arguments around not bothering to check the return of malloc(). I can say in this case. char *large = malloc((size_t)-1); if(NU
by technion 10y ago
There has been a lot of arguments around not bothering to check the return of malloc(). I can say in this case.
char *large = malloc((size_t)-1);
if(NULL == large) {
perror("Well that failed");
Compiles fine and outputs:
Well that failed: Cannot allocate memory