2 * useful structures/macros
4 * 2011, Operating Systems
21 static VOID PrintLastError(const PCHAR message)
26 FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK,
34 fprintf(stderr, "%s: %s\n", message, errBuff);
37 #define ERR(call_description) \
39 fprintf(stderr, "(%s, %d): ", \
40 __FILE__, __LINE__); \
41 PrintLastError(call_description); \
44 #elif defined (__linux__)
46 /* error printing macro */
47 #define ERR(call_description) \
49 fprintf(stderr, "(%s, %d): ", \
50 __FILE__, __LINE__); \
51 perror(call_description); \
55 #error "Unknown platform"
58 /* print error (call ERR) and exit */
59 #define DIE(assertion, call_description) \
62 ERR(call_description); \