Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

dbg.h

Name: Anonymous 2016-06-15 11:47

#ifndef DBG_H__
#define DBG_H__

#include <errno.h>
#include <stdio.h>
#include <string.h>

#ifdef NDEBUG
#define dbg(M, ...)
#else
#define dbg(M, ...) fprintf(stderr, "DEBUG %s:%d: " M "\n", __FILE__, __LINE__, ##__VA_ARGS__)
#endif

#define dbg_errno() (errno == 0 ? "None" : strerror(errno))
#define log_err(M, ...) fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, dbg_errno(), ##__VA_ARGS__)
#define log_warn(M, ...) fprintf(stderr, "[WARN] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, dbg_errno(), ##__VA_ARGS__)
#define log_info(M, ...) fprintf(stderr, "[INFO] (%s:%d) " M "\n", __FILE__, __LINE__, ##__VA_ARGS__)
#define chk(A, M, ...) if(!(A)) { log_err(M, ##__VA_ARGS__); errno=0; goto error; }
#define chk_def(M, ...) { log_err(M, ##__VA_ARGS__); errno=0; goto error; }
#define chk_mem(A) chk((A), "Out of memory.")
#define chk_dbg(A, M, ...) if(!(A)) { dbg(M, ##__VA_ARGS__); errno=0; goto error; }

#endif

Name: Anonymous 2016-06-15 16:11

k

Name: Anonymous 2016-06-15 17:15

C macros are such a shit

Name: Anonymous 2016-06-15 18:34

Check em

Name: Anonymous 2016-06-15 18:41

Check em

Name: Anonymous 2016-06-15 18:46

>>3
#define private public
#define protected public
// fuck the police

​ ​ ​ ​ ​ ​ -- John Carmack

Name: Anonymous 2016-06-15 21:49

What programming language is this?

Name: Anonymous 2016-06-15 23:15

Check em

Don't change these.
Name: Email:
Entire Thread Thread List