CIR Playground
Load example...
CIR on GitHub
Input
Run
// Welcome to CIR Playground! // // CIR is a compile-time evaluation and metaprogramming system // for the C Programming Language. CIR Playground lets you try out CIR without // the hassle of building and installing it on your computer. // // Let's start with a fibonacci function that is evaluated at compile time. // // Click "Run" to see the result! #include <stdio.h> static int fib(int n) { int a = 0, b = 1; for (int i = 0; i < n; i = i + 1) { int c = b; b = a + b; a = c; } return a; } int main(void) { // The use of @ evaluates fib(20) at compile time. // First, try running this program as-is by clicking "Run"! // Next, try removing the @, click "Run", and compare the result! printf("The answer is: %d\n", @fib(20)); return 0; }
stdout
stderr
Load Example...
×
00 - Compile-time fibonacci
01 - Inline Repeat
02 - Compile-time strtok
03 - Does a code call a function
04 - C Preprocessor identifiers may be accidentally shadowed
05 - CIR identifiers won't be accidentally shadowed
06 - C Preprocessor accidental capture of symbols
07 - CIR won't accidentally capture symbols
08 - bf-to-C (low level ver)
09 - bf-to-C (with quote-antiquote)
10 - async-await
11 - Embed an external file
12 - zlib