Skip to content

Commit 51c8241

Browse files
authored
Update 2025-11-30-comptime-c-functions.md
1 parent 2340733 commit 51c8241

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

_posts/2025-11-30-comptime-c-functions.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ main:
2020
ret
2121
```
2222

23+
Here is how it is achieved in C:
24+
- `static inline` allows inlining across compilation boundaries.
25+
- `__attribute__((always_inline))` forces the compiler to inline functions.
26+
- Constant buffer addresses + sizes let the optimizer trace through `memcpy()` calls.
27+
- All operations become statically analyzable, reducing to constants.
28+
- `assert()` calls get eliminated when conditions are provably true.
29+
2330
[Link-time optimization](https://en.wikipedia.org/wiki/Interprocedural_optimization) should allow GCC and Clang to perform these optimizations even when the code is split across several object files.
2431

2532
# Generic Stack

0 commit comments

Comments
 (0)