Skip to content

Commit

Permalink
Ameliorated ASSERT() macro
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandMarchand committed Jul 12, 2022
1 parent 981cc52 commit 92954e6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
#include <stdlib.h>
#include <stdio.h>

#define ASSERT(expr, error) \
{ \
if (!(expr)) { \
fprintf(stderr, error); \
fprintf(stderr, "\n"); \
exit(EXIT_FAILURE); \
} \
}
#define ASSERT(expr, ...) \
do { \
if (!(expr)) { \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
exit(EXIT_FAILURE); \
} \
} while(0)

0 comments on commit 92954e6

Please sign in to comment.