Skip to content

Commit 92e770c

Browse files
authored
Update 2025-11-30-comptime-c-functions.md
1 parent badc121 commit 92e770c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ date: 2025-11-30 12:00:00 +0100
77
Compile-time function execution is great, but what if:
88
1. You're stuck with C.
99
2. You don't want to use evil C macros, which are debugging nightmares.
10-
3. You want generic data structures that work for all types.
10+
3. You want generic data structures that work for all types, and that can use `malloc()` and `free()` internally.
1111

1212
The below data structure showcase programs get optimized away at compile time by Clang and GCC:
1313
```nasm
@@ -18,7 +18,7 @@ macro_version:
1818
ret
1919
```
2020

21-
The best use-case I can think of for this technique is generating lookup tables at compile-time, since functions like `sin()` *also* successfully get optimized away. This technique seems to also work fine however for implementing runtime-allocated data structures, without needing macros.
21+
The best use-case I can think of for this technique is generating lookup tables at compile-time, as math functions like `sin()` *also* get optimized away.
2222

2323
# Optimization tricks
2424

0 commit comments

Comments
 (0)