Am 03.08.2011 09:31, schrieb Michael Schnell:
On 08/02/2011 06:39 PM, Jürgen Hestermann wrote:


In general I find the "with" statement very useful and have used and
do use it a lot.
If you are clever enough to avoid confusion ;) . (Such as a nested with
that defines the same identifier for both "with"ed record and maybe same
is also defined as the "implicitly with"ed "self" (instance record).
And it also saves the program from calculating array indices and other
references in these expressions multiple times so it speeds up the
code too.
A decent compiler should be able to perform this optimization on it's
own account.

The code that calculates the indices and handles other references could have side effects, so the compiler would not be able to optimize them. If you use this code once inside the "with"-clause you tell the compiler to do that calculation only once and that you are aware of possible side effects (or thus not occuring side effects).

Regards,
Sven

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to