4 ms·
> Attributes like inline or likely rarely do that much, so that doesn't explain it. They are merely suggestions, frequently ignored In Rust you can annotate a
by kouteiheika 4y ago
> Attributes like inline or likely rarely do that much, so that doesn't explain it. They are merely suggestions, frequently ignored
In Rust you can annotate a function with `#[inline(always)]` which makes is not a suggestion; it'll always inline it AFAIK (unless it calls itself recursively where, by definition, inlining is not possible).
- jcelerier 4y agoAll major c++ compilers have similar attributes but they are heavily discouraged by the compiler authors. Clang also has a flatten attribute which can be interesting: it does the conjugate of marking functions inline: the function to which it is applied to will have all its own content inlined, e.g. [[clang::flatten]] void f() { a(); b(); } will inline a and b