From: git Date: Thu, 23 Apr 2026 19:08:26 +0000 (-0400) Subject: refine readme X-Git-Url: https://git.datadissipation.net/?a=commitdiff_plain;h=HEAD;p=va-opt-c.git refine readme --- diff --git a/README.md b/README.md index 71124db..bd8ca29 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,13 @@ _Almost_ fully C99 compatible `##__VA_ARGS__` and `__VA_OPT__()` alternative. The compiler needs to support empty `__VA_ARGS__` (not to C99 spec) for this to work, though all compilers tested had no issue with that (even those with partial C99 support, like lacc) -### Usage +### Usage and hacking Replace `__VA_ARGS__` with `VA_OPT_C(__VA_ARGS__)`: ``` -#define prlog(f, ...) fprintf(stderr, f, VA_OPT_C(__VA_ARGS__)) +#define prlog(f, ...) fprintf(stderr, f /* no comma here */ VA_OPT_C(__VA_ARGS__)) ``` + +You can also define your own top level macro, `I_MAKE_TEST()` and the test macros themselves to +add a lot more conditional functionality based on `__VA_ARGS__` being empty or not. diff --git a/va_opt.h b/va_opt.h index f8f7c5e..25fc491 100644 --- a/va_opt.h +++ b/va_opt.h @@ -2,7 +2,7 @@ #define VA_OPT_H_ 1 /* * Credit for a big part of the macro madness: - * Jens Gudstedt + * Jens Gustedt * https://gustedt.wordpress.com/2010/06/08/detect-empty-macro-arguments/ */ #define I_COND_COMMA(...) ,