<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body smarttemplateinserted="true" text="#000000" bgcolor="#FFFFFF">
<div id="smartTemplate4-template">Hi,<br>
<br>
<blockquote type="cite">procedure TStrBuilder.append(const s:
RawByteString); <br>
begin <br>
append(pchar(pointer(s)), length(s)); //inlinetest.pas(24,3)
Note: Call to subroutine "procedure TStrBuilder.append(const
p:PChar;const l:Int64);" marked as inline is not inlined <br>
end; </blockquote>
</div>
<div><br>
</div>
<div>this seems to help</div>
<div><br>
</div>
<div>procedure TStrBuilder.append(const s: RawByteString); <br>
</div>
<div>var p: pchar;</div>
<div>begin </div>
<div>Â Â p := pchar(pointer(s));</div>
<div>Â Â append(p, length(s)); <br>
</div>
<div>end;<br>
<div><br>
</div>
</div>
<div><br>
</div>
<div>
<blockquote type="cite">I would personally be in favour of
removing all of the inlining hints, because they are specific to
a particular compiler version and mainly cause people to waste
time on premature optimisation (or on what they think is an
optimisation, but in many cases slows down things due to
increased instruction cache pressure). </blockquote>
</div>
<div><br>
</div>
<div>After updating from 3.1 to 3.3 I only have to look at around
one thousand hints<br>
<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>The one-pass thing is probably the reason it now complains
about all inline functions in dependency cycles, unit A uses unit
B that uses unit A. Then unit A can't inline something unit B.Â
Any way around that? <br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
Best,<br>
Benito </div>
<br>
<div class="moz-cite-prefix">Am 02.01.19 um 00:41 schrieb Jonas
Maebe:<br>
</div>
<blockquote type="cite"
cite="mid:342d9b5fe6b75e43524d5abfd806fc72@watlock.be">On
2019-01-02 00:19, Benito van der Zander wrote: <br>
<br>
<blockquote type="cite">procedure TStrBuilder.append(const s:
RawByteString); <br>
begin <br>
append(pchar(pointer(s)), length(s)); //inlinetest.pas(24,3)
Note: Call to subroutine "procedure TStrBuilder.append(const
p:PChar;const l:Int64);" marked as inline is not inlined <br>
end; <br>
</blockquote>
<br>
The compiler does not support inlining calls with parameters that
cast a managed type to an unmanaged type at this time. <br>
<br>
Regarding the reason why something cannot be inlined: sometimes
you can get more information with -vd, but not always (and even
then the reason may be vague). <br>
<br>
I would personally be in favour of removing all of the inlining
hints, because they are specific to a particular compiler version
and mainly cause people to waste time on premature optimisation
(or on what they think is an optimisation, but in many cases slows
down things due to increased instruction cache pressure).
Especially in this case: there is nothing potentially wrong with
such a call, nor is the method in general not inlinable, so there
is no way to get rid of the hint other than by removing the inline
directive altogether (or by adding a version of that routine with
a different name that is not declared as "inline"). This only
promotes complicating code without any potential improvement of
productivity or clarity of the code/programmer intent. <br>
<br>
<br>
Jonas <br>
_______________________________________________ <br>
fpc-pascal maillist - <a class="moz-txt-link-abbreviated"
href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<br>
<a class="moz-txt-link-freetext"
href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a><br>
</blockquote>
</body>
</html>