[*] Update readme

This commit is contained in:
Reece Wilson 2021-10-28 21:13:24 +01:00
parent 17a19fd90d
commit a265a6ffa5

View File

@ -4,6 +4,13 @@
Implements a `AU_FOR_EACH_n` X-style macro that accepts a macro parameter where 'N' is the input parameters of the macro Implements a `AU_FOR_EACH_n` X-style macro that accepts a macro parameter where 'N' is the input parameters of the macro
## Example ## Example
```C
#define HELLO_WORLD(that, n) that n
#define COUNT_TO_9 AU_FOR_EACH_THAT(HELLO_WORLD, int, 1, 2, 3, 4, 5, 6, 7, 8, 9)
const char *kCountTo9 = AU_STRINGIFY(COUNT_TO_9); // generic what macro
assert(strcmp(kCountTo9, "int 1 int 2 int 3 int 4 int 5 int 6 int 7 int 8 int 9") == 0);
```
```C ```C
#define HELLO_WORLD(n) n #define HELLO_WORLD(n) n
@ -22,6 +29,7 @@ const char *kCountTo9 = AU_STRINGIFY(COUNT_TO_9); // generic what macro
assert(strcmp(kCountTo9, "0, 1, 2, 3, 4, 5, 6, 7, 8, 9") == 0); assert(strcmp(kCountTo9, "0, 1, 2, 3, 4, 5, 6, 7, 8, 9") == 0);
``` ```
*Note, simple tests akin to the above examples may fail due to whitespace padding.* *Note, simple tests akin to the above examples may fail due to whitespace padding.*
## Users ## Users