What does 'inline' mean?

Stanislav Blinov stanislav.blinov at gmail.com
Tue Jun 9 01:26:23 UTC 2020


On Tuesday, 9 June 2020 at 00:36:18 UTC, Manu wrote:

> What's funny is, in most cases, whether the function is 
> ACTUALLY inlined is
> not really interesting in 2020.
> What inline allows is control over the binary environment as I 
> describe. I
> read it these days as "inline to the calling CU" rather than 
> "inline to the
> calling function".
>
> There are cases where inline is really important, and I do want 
> an error if it fails; for instance, if you have a leaf function 
> (does not allocate any stack memory), it's only possible to 
> make calls from that function where the callee is inlined... 
> and if inlining fails, your caller will lose its no-stack-frame 
> requirement. I've had this come up numerous times, and in those 
> cases, a really-strong-does-make-compile-error inline would be 
> useful, but C++ doesn't have anything like that.

Maybe it's a case where a clear disambiguation is in order? E.g. 
make a new

pragma(local);

...which would instruct the compiler to do what you're 
describing. Or, perhaps, expand the range of options for the 
existing pragma(inline), from the current bool to an enum of 
behaviors.


More information about the Digitalmars-d mailing list