Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fcard/c23meta
Metaprogramming exercises using c23.
https://github.com/fcard/c23meta
c c23 cpreprocessor metaprogramming
Last synced: 27 days ago
JSON representation
Metaprogramming exercises using c23.
- Host: GitHub
- URL: https://github.com/fcard/c23meta
- Owner: fcard
- License: mit
- Created: 2024-07-30T20:47:19.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-13T17:21:10.000Z (5 months ago)
- Last Synced: 2024-10-17T12:16:58.627Z (3 months ago)
- Topics: c, c23, cpreprocessor, metaprogramming
- Language: C
- Homepage:
- Size: 871 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C23META
## Experiments with c23's preprocessorImplements numeric computation and collections using only the C Preprocessor.
```c
#include "numbers/numbers.h"
#include "collections/list/list.h"#define FACTORIAL(N)\
LIST_FOLDL(U128H_MUL,\
LIST_MAP(U128H_FROM_U32H,\
LIST_RANGE(U32H_1, N)), U128H_1)#define S(X) STRING(U128H_PRINT(X))
int main(void) {
printf("%s\n", S(FACTORIAL(U32H_1)));
printf("%s\n", S(FACTORIAL(U32H_5)));
printf("%s\n", S(FACTORIAL(U32H_10)));
printf("%s\n", S(FACTORIAL(U32H_15)));
printf("%s\n", S(FACTORIAL(U32H_20)));
printf("%s\n", S(FACTORIAL(U32H_30)));
}
```
```
1
120
3628800
1307674368000
2432902008176640000
265252859812191058636308480000000
```