#include <stdio.h>
#include <string.h>
#include <strings.h> //bzero
#include <stdlib.h>
#define alloca malloc // no alloca in the standard
#define DEBUG_STREAM stderr
#define BUFFER_SIZE_DEBUG 500
#define EVALUATE_TYPE(x) 1
#define _DEBUG_ADD(string, ...) \
do{ \
if (EVALUATE_TYPE(string)){ \
size_t size = strlen(string) + BUFFER_SIZE_DEBUG; \
char *buffer = alloca(size); \
bzero(buffer, size); \
snprintf(buffer, size, string, __VA_ARGS__); \
fwrite(buffer, strlen(buffer), 1, DEBUG_STREAM); }} \
while(0)
int main(void) {
_DEBUG_ADD("%d %d %d\n", 1, 2, 3);
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KI2luY2x1ZGUgPHN0cmluZ3MuaD4gLy9iemVybwojaW5jbHVkZSA8c3RkbGliLmg+CgojZGVmaW5lIGFsbG9jYSBtYWxsb2MgLy8gbm8gYWxsb2NhIGluIHRoZSBzdGFuZGFyZAojZGVmaW5lIERFQlVHX1NUUkVBTSBzdGRlcnIKI2RlZmluZSBCVUZGRVJfU0laRV9ERUJVRyA1MDAKCiNkZWZpbmUgRVZBTFVBVEVfVFlQRSh4KSAxCgojZGVmaW5lIF9ERUJVR19BREQoc3RyaW5nLCAuLi4pICAgICAgICAgICAgICAgICAgICAgXApkb3sgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAppZiAoRVZBTFVBVEVfVFlQRShzdHJpbmcpKXsgICAgICAgICAgICAgICAgICAgICAgICAgXApzaXplX3QgIHNpemUgPSBzdHJsZW4oc3RyaW5nKSArIEJVRkZFUl9TSVpFX0RFQlVHOyAgXApjaGFyICAgICpidWZmZXIgPSBhbGxvY2Eoc2l6ZSk7ICAgICAgICAgICAgICAgICAgICAgXApiemVybyhidWZmZXIsIHNpemUpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXApzbnByaW50ZihidWZmZXIsIHNpemUsIHN0cmluZywgX19WQV9BUkdTX18pOyAgICAgICAgXApmd3JpdGUoYnVmZmVyLCBzdHJsZW4oYnVmZmVyKSwgMSwgREVCVUdfU1RSRUFNKTsgfX0gXAp3aGlsZSgwKQoKCgppbnQgbWFpbih2b2lkKSB7CgkgX0RFQlVHX0FERCgiJWQgJWQgJWRcbiIsIDEsIDIsIDMpOwp9Cg==