[fpc-pascal] New feature: IfThen() intrinsic

Michael Van Canneyt michael at freepascal.org
Tue Feb 2 14:38:43 CET 2016



On Tue, 2 Feb 2016, Sven Barth wrote:

> Am 02.02.2016 13:38 schrieb "Andreas Berger" <Andreas at thebergerclan.org>:
>>
>>
>> On Tue 02/02/2016 09:27, Jonas Maebe wrote:
>>>
>>>
>>> The parameter evaluation order issue is irrelevant in this context:
> Delphi guarantees left-to-right (or used to anyway, this may have changed),
> FPC doesn't guarantee anything.
>>>
>> Wow, what's this? I never knew this. I have been using Borland products
> since TP 1.0 and for me left-to-right is automatic, I don't even think
> about it. If FPC doesn't guarantee this my code is full of potential
> problems.
>> BTW using left-to-right does not mean non-robust code if it is guaranteed.
>
> FPC indeed does not guarantee the evaluation order (and that's even
> documented AFAIK).

Not to my knowledge.

> It might change the evaluation order to generate better
> code. It only guarantees that each parameter is evaluated exactly once
> (though in case of expressions without calls it might reuse results in
> certain optimization settings, I don't know that currently though) and that
> the parameters are passed in the correct order.

Well, it would be strange if it behaved otherwise :)

Michael.



More information about the fpc-pascal mailing list