On Tue, 10 Nov 2015 12:26:56 +0100
Jürgen Hestermann <juergen.hesterm...@gmx.de> wrote:

>[...]
> Does that mean, that local variables and with statements are treated 
> completely identically?

A local var can be changed. Without optimization the compiler puts the
local var on the stack. With optimization enabled the compiler can
find out that the local var is only read, which is also true for a 
with-expression and applies the same optimizations.

Optimizing read only variables is basic code optimization.

> Are both held in registers with the same mechanism and will there never be an 
> (speed) adavantage of one of them?
> If there is only the chance that it may speed up the code (even when only on 
> certain platforms) then I would like to know it.

If speed matters you should enable optimization. When optimization is
enabled there is no difference.

Mattias

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to