On Fri, 30 Apr 2004 11:02:40 +0200, "Davide" <> wrote:
>Hello,
>this could be a trivial for question for you, anyway:
>
>I have an hi-level code operation in which I need to access several times
>the same element of an array, say A(K).
>Is it -in general- more efficient to assign, at the beginning of the
>operation, that element to a local variable (X:=A(K))
>to be used in the rest of the operation instead of using each time A(K)?
>
Probably not - the compiler will do that itself if appropriate.
However, it may (and I emphasize *may*) be more understandable and
easier to maintain, if that particular array element has a
well-defined meaning of its own, aside from being just an element of
the array.
In general, go for readability and maintainability and let the
compiler worry about the details.
--
Al Balmer
Balmer Consulting