| description | C99 __VA_OPT__() alternative |
| last change | Thu, 23 Apr 2026 19:08:26 +0000 (15:08 -0400) |
| URL | git://git.datadissipation.net/va-opt-c.git |
| https://git.datadissipation.net/va-opt-c.git | |
| content tags |
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)
Replace __VA_ARGS__ with
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.
| 2026-04-23 | git | refine readme master | commit | commitdiff | tree | snapshot (tar.zst tar.gz zip) |
| 2026-04-22 | git | initial public commit | commit | commitdiff | tree | snapshot (tar.zst tar.gz zip) |
| 7 weeks ago | master | shortlog | log | tree |