[fpc-pascal] with statement using mulltiple objects
Jim Leonard
trixter at oldskool.org
Mon Sep 15 03:06:12 CEST 2014
On 9/13/2014 2:02 PM, Sven Barth wrote:
> It has always worked in this manner. It's just for abbreviating typing,
> not for combining properties. (and then the with-variant with multiple
> elements is even more seldomly used than the single-element one...)
In the Turbo Pascal days, WITH allowed for some user-directed compiler
optimization. From the TP7 manual:
"In certain situations, Turbo Pascal's code generator can eliminate
redundant pointer-load instructions, shrinking the size of the code and
allowing for faster execution. When the code generator can guarantee
that a particular pointer remains constant over a stretch of linear code
(code with no jumps into it), and when that pointer is already loaded
into a register pair (such as ES:DI), the code generator eliminates
additional redundant pointer-load instructions in that block of code.
A pointer is considered constant if it's obtained from a variable
parameter (variable parameters are always passed as pointers) or from
the variable reference of a WITH statement. Because of this, using WITH
statements is often more efficient (but never less efficient) than
writing the fully-qualified variable for each component reference."
--
Jim Leonard (trixter at oldskool.org)
Check out some trippy MindCandy: http://www.mindcandydvd.com/
A child borne of the home computer wars: http://trixter.oldskool.org/
You're all insane and trying to steal my magic bag!
More information about the fpc-pascal
mailing list