Created
March 23, 2016 01:18
-
-
Save alesegdia/fb9aa5b93f4027416bea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <assert.h> | |
/** | |
* http://c.learncodethehardway.org/book/ex20.html | |
*/ | |
#define clean_errno() (errno == 0 ? "None" : strerror(errno)) | |
#define log_error(M, ...) fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__) | |
#define assertf(A, M, ...) if(!(A)) {log_error(M, ##__VA_ARGS__); exit(1); } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment