Skip to content

Commit 0fd00f0

Browse files
authored
Update 2025-11-30-comptime-c-functions.md
1 parent bf76a27 commit 0fd00f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Here is how it is achieved in C:
2727
- All operations become statically analyzable, reducing to constants.
2828
- `assert()` calls get eliminated when conditions are provably true.
2929

30-
It's fundamentally impossible for heap allocation to work with compile-time evaluation, and this applies to C, Zig, and Rust equally.
30+
This optimization requires stack-allocated buffers with constant addresses. Heap allocation breaks the optimization because the compiler can't trace memory operations through dynamic allocations.
3131

3232
[Link-time optimization](https://en.wikipedia.org/wiki/Interprocedural_optimization) with `-flto` should allow GCC and Clang to perform these optimizations even when the code is split across several object files.
3333

0 commit comments

Comments
 (0)