3 ms·
Why isn’t the compiler just doing inline whenever possible? Why is it a user-facing feature of the language, it looks like it should be a compiler optimization
by larsnystrom 4y ago
Why isn’t the compiler just doing inline whenever possible? Why is it a user-facing feature of the language, it looks like it should be a compiler optimization to me.
- kristoff_it 4y agoInlining (in the C/C++ sense of the term) is not always preferable. On top of that, in this specific case, `inline` has a Zig-specific meaning that pertains to generics and metaprogramming in a way that has not much to do with the C/C++ use of the term.
- anonymoushn 4y agoThe programmer might know more than the compiler about which things should be expanded at compile time and which things should not. Zig is intended to be able to be used to generate optimal code.