[fpc-devel] Bug or Feature? Inline of code from Units does not work when types uses in code are defined in implementation

Michael Ring mail at michael-ring.org
Mon Apr 6 19:23:07 CEST 2015


So do you think it is worth to extend documentation for inline? Or 
perhaps the compiler could give a warning when code is not suitable for 
inlining or is this decision done when a caller requests inlining and 
not when the inline function gets compiled?


Am 06.04.15 um 18:59 schrieb Florian Klaempfl:
> Am 06.04.2015 um 17:53 schrieb Michael Ring:
>> Take the following unit, my goal is to have the code called in the unit
>> inlined in the main code.
>> This works fine when
>> type
>>    pLongWord = ^LongWord;
>> is defined in the interface of the unit.
>> if this is defined in Implementation then Inlining of the code does not
>> work.
>> Is this correct behaviour? Or should both ways work?
> Inline is only a recommendation to the compiler. Such a definition in
> the implementation part prevents indeed inlining.
> In this particular case I recommend that you just leave the definition
> away so compiler uses that one of the system unit.
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

More information about the fpc-devel mailing list