christian.bau wrote:
) Well, this is rubbish. If I have a 2000 line function, and then write
) a fifty line function that calls the 2000 line function 50 times, and
) then write another fifty line function that calls the previous
) function inline, and then twice more, then your compiler will just
) crash without any good reason.
No, it will crash because you *SPECIFICALLY TOLD* the compiler
to inline all those function calls.
No, he did not, the "inline" keyword does not request that the function
be inlined. It "suggests that calls to the function be as fast as
possible". If inlining a particular function would make it slower, then
for that particular function, the "inline" keyword is a suggestion that
inlining NOT be performed, counterintuitive though that may seem.
It's just a suggestion, so failing to honor would not render the
compiler non-conforming; but it counts as poor QoI.
) And if I just have a function that does fifty calls in a row to the
) 2000 line function, then the code will probably run ten times slower
) because it overruns all caches.
Irrelevant. If the programmer specifically requests that a function
be inlined, then who is the compiler to question that request ?
C does not provide a keyword for requesting that a function be inlined;
the 'inline' keyword is certainly not such a keyword; as shown above, it
sometimes explicit suggests that the code NOT be inlined. If a new
keyword were created for requesting inlining, regardless of the effect
on the speed of the code (perhaps it could be called
_inline_even_if_slower), then use of that keyword would carry the
implications you've mistakenly concluded about the "inline" keyword.