Is inlining in fact specific to C and C++ as the description implies, or should it be merged into inline?
2 Answers
Given, especially in the light of LTO and C++ inline variables, function inlining and the effects of the inline
keyword in C and C++ (and probably other languages from the C family, too) have become almost orthogonal, I am opposed to merging the tags.
Instead, the inline tag wiki should be updated to more closely reflect the meaning of the keyword. A clean up of the tag may also be needed, as it is also used for all sorts of inline elements like pictures in e-mails. That probably would not make a lot of sense as a tag. If inline has too many different meanings, we may want to split it; but that would be a different discussion.
Also, we should update the tag wiki of inlining to reflect the fact that the concept is indeed not specific to C and C++.
Update: I updated the two tag wikis to reflect the suggestions from this as the top answer.
-
3
-
@Braiam If you feel like further cleanup of the tag [inline] is required, please start a new discussion as a new question. What's being discussed here is whether [inline] and [inlining] should be merged. Your comment does not seem to address this at all.– Baum mit Augen ModSep 22, 2018 at 4:11
-
5Currently both tags have the same description. So what is that orthogonal difference you are talking about?– BergiSep 22, 2018 at 9:57
-
1@Bergi Historically, the
inline
keyword was introduced to C for the programmer to hint the compiler which functions to inline. To make that easier, inline functions were special-cased in the ODR. Today (and for quite a few years already), the optimizers ignore the inline hint as their heuristics are (usually) much better anyway. This strips theinline
keyword off its original meaning, and only the ODR effects are left. In the light of this fact, new features like C++inline
variables make sense, where today's ODR meaning (rather than the original inlining meaning) becomes very clear.– Baum mit Augen ModSep 22, 2018 at 21:07 -
Oh, I had to look that up. But wouldn't it make more sense to tag that as [one-definition-rule] or [c-inline-keyword] or [c++-inline-keyword] or [inline-keyword]? I'm not sure whether
inline
is a keyword only in C/C++.– BergiSep 22, 2018 at 21:13 -
1@Bergi It probably is not exclusive to C and C++, and for the discussion about what exactly to do with the tag [inline], input from domain experts of those other languages would be helpful. It does look like at least some cleanup would be required. However, the main point of this answer, "don't merge the tags", stands regardless.– Baum mit Augen ModSep 22, 2018 at 21:20
-
A lot of languages have inlining annotations. Rust and Haskell come to mind. I think the combination of
[inlining]
with the language tag would suffice to let readers know whichinline
was meant. I think that[c-inlining]
would be a bad precedent, as we can make a combinatorial explosion of[language+feature]
tags just because the semantics might differ somewhat in each language. Sep 23, 2018 at 12:02
The tag wikis are currently useless, but there is a significant distinction to be made, at least for C and C++:
- The inline keyword tells the compiler what semantics you want. Notably, it prevents ODR violations if you use it right. (which is surprisingly complicated; I wrote an answer here detailing all the cases I know about)
- The concept of inlining refers to an effect that is only observable by inspecting the binary, or perhaps through timing.
Depending on exactly how far a language is from C, one or both of these concepts might not apply.
non-C-family tag:inline
questions: 2080/2955