/
index
/
va-opt-c.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
inline
| side by side (parent:
5fa8078
)
refine readme
master
author
git
<redacted>
Thu, 23 Apr 2026 19:08:26 +0000
(15:08 -0400)
committer
git
<redacted>
Thu, 23 Apr 2026 19:08:26 +0000
(15:08 -0400)
README.md
patch
|
blob
|
history
va_opt.h
patch
|
blob
|
history
diff --git
a/README.md
b/README.md
index 71124dba05f122fb763676b565d6e93c2bbc6f29..bd8ca294b6f4685e1e67020768576ebcab173e66 100644
(file)
--- 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)
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__)`:
```
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 f8f7c5ef3dfa3ca0630d780b815d0eacdeb07653..25fc491e97c5d390dc32de38c0b347e9dfcba14b 100644
(file)
--- 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:
#define VA_OPT_H_ 1
/*
* Credit for a big part of the macro madness:
- * Jens Gu
d
stedt
+ * Jens Gustedt
* https://gustedt.wordpress.com/2010/06/08/detect-empty-macro-arguments/
*/
#define I_COND_COMMA(...) ,
* https://gustedt.wordpress.com/2010/06/08/detect-empty-macro-arguments/
*/
#define I_COND_COMMA(...) ,