Check out how inline functions work in the W.I.P. @ziglang self-hosted compiler. You can even have recursive inline functions, it all works fine!
4
4
128
I thought inlining was a runtime optimization. This looks like constexpr?
2
0
1
Replying to @itsamekk @ziglang
Good point, in this case the parameter is compile-time known. Here's another example!

6:44 AM · Jan 3, 2021

2
0
6
As a reminder this is a debug build, not an optimized build
0
0
0
Technically this is still compile time because zig can detect that C variable is a constant can be used to expand the function recursively. Am I right?
2
0
0
Yeah, I don't know if _start() is permitted to pass in arguments, but if so, using those would unquestionably be runtime.
0
0
1