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

2015-04-06 Thread Michael Ring

Thanks,

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?


Michael

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@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


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

2015-04-06 Thread Florian Klämpfl
Am 06.04.2015 um 19:23 schrieb Michael Ring:
 Thanks,
 
 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?

If the situation is clear, the compiler gives a hint. In this case, the 
procedure is inlined if it
is called in the same unit, otherwise not.

The decision, if a procedure can be inlined is pretty difficult and changes 
also from time to time,
so I prefer neither to document (situation might change and documentation gets 
wrong) it nor
increase the hints regarding this (sometimes it is really hard to explain why 
something is not inlined).
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


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

2015-04-06 Thread 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@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] bug or feature?

2013-11-24 Thread Sergei Gorelkin

25.11.2013 3:31, Paul Ishenin пишет:

22.11.2013 23:09, Sergei Gorelkin пишет:

Hello together,

The following compiles and executes correctly in objfpc mode (and rejected by 
Delphi and by FPC in
mode Delphi). Is implicit taking address of array there by design?

Yes, it is a FPC feature which is widely used by Lazarus.


This is good to know, thanks!

Sergei


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel