Hi,

This pattern is not inherently efficient. Why should it be ?


It is not efficient, because of the pointless instruction!



Bye,
Benito



Am 21.08.2017 um 08:39 schrieb Michael Van Canneyt:


On Sun, 20 Aug 2017, Benito van der Zander wrote:

Hi,

why does fpc not remove the calculation of the return value of inline functions, when the return value is unused?

For example

type TUtility = class
 function doSomething: TUtility; inline;
end;


It is a popular pattern to add result := self; to _every_ method (or result := @self in objects/records), so it can be chained as dosomething().dosomething().dosomething(),..... but one cannot use it with fpc efficiently, when it inserts too many unnecessary instructions

A strange statement.

This pattern is not inherently efficient. Why should it be ?

It's just something that boiled over from other languages and some people
see it as a nifty way of writing code.

Michael.
_______________________________________________
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

Reply via email to