M
Marlene Stebbins
At one point in my program I have about a dozen calls to malloc. I want
to check for malloc failure, but I don't want to write:
if((buffer_x = malloc(BUFSIZE * sizeof(*buffer_x))) == NULL)
{
exit(EXIT_FAILURE);
fprintf(stderr, "malloc failed");
}
for each individual call if there is a stylistically better way. How
would this be handled in commercial code?
to check for malloc failure, but I don't want to write:
if((buffer_x = malloc(BUFSIZE * sizeof(*buffer_x))) == NULL)
{
exit(EXIT_FAILURE);
fprintf(stderr, "malloc failed");
}
for each individual call if there is a stylistically better way. How
would this be handled in commercial code?