[fpc-pascal] Argument evaluation order in Free Pascal and Delphi

Michael Schnell mschnell at lumino.de
Thu Oct 31 09:45:23 CET 2013

On 10/28/2013 02:47 PM, Dmitry Pribysh wrote:
> As it is written in Free Pascal wiki 
> <http://wiki.freepascal.org/Code_Conversion_Guide#Order_of_parameter_evaluation>, 
> order of parameter evaluation is not defined in FPC, but it is defined 
> in Delphi (Delphi guarantees left-to-right evaluation order).
IMHO =in fact evaluation of a parameter should not be guaranteed at all.

The compiler should be free to inline a function, detect that the 
parameter is not necessary for the evaluation of the function result and 
drop the evaluation of the parameter (maybe giving a warning or error 
message if that might trigger side-effects).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131031/598fc1c4/attachment.html>

More information about the fpc-pascal mailing list