<div dir="ltr"><div dir="ltr">On Tue, Jun 9, 2020 at 11:30 AM Stanislav Blinov via Digitalmars-d <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tuesday, 9 June 2020 at 00:36:18 UTC, Manu wrote:<br>
<br>
> What's funny is, in most cases, whether the function is <br>
> ACTUALLY inlined is<br>
> not really interesting in 2020.<br>
> What inline allows is control over the binary environment as I <br>
> describe. I<br>
> read it these days as "inline to the calling CU" rather than <br>
> "inline to the<br>
> calling function".<br>
><br>
> There are cases where inline is really important, and I do want <br>
> an error if it fails; for instance, if you have a leaf function <br>
> (does not allocate any stack memory), it's only possible to <br>
> make calls from that function where the callee is inlined... <br>
> and if inlining fails, your caller will lose its no-stack-frame <br>
> requirement. I've had this come up numerous times, and in those <br>
> cases, a really-strong-does-make-compile-error inline would be <br>
> useful, but C++ doesn't have anything like that.<br>
<br>
Maybe it's a case where a clear disambiguation is in order? E.g. <br>
make a new<br>
<br>
pragma(local);<br>
<br>
...which would instruct the compiler to do what you're <br>
describing. Or, perhaps, expand the range of options for the <br>
existing pragma(inline), from the current bool to an enum of <br>
behaviors.<br></blockquote><div><br></div><div>I've suggested that before, and I think that's what I'd encourage:</div><div> pragma(inline, never) do not inline</div><div> pragma(inline, true) like C/C++, emit to calling CU, hint preference the optimiser (if it is capable of receiving hints)<br></div><div> pragma(inline, force) same as true, but error when it fails<br></div></div></div>