Comment

Comment by snidane

I have always wondered why functions have to be declared inline when it is more up to the caller to declare whether to inline the contents of the function at call site.

So instead of

  inline int f(int x) { return x * x; }
  int main() { f(3); }
you'd want to do

  int f(int x) { return x * x; }
  int main() { inline f(3); }
I have seen this implemented in Zig for loops (inline for, inline while). Is there support for this in other languages?
parent snidane 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton