As a C newbie I'm having trouble understanding the following code:
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \
} while (0)
I gathered that the reason this function is #define
d is to override an existing function, but what is the point of a do ... while(0)
loop with an unconditional exit()
statement? Is it not possible to write this without the loop construct?