Re: HLL design

Hans-Peter Diettrich <>
21 Oct 2006 22:05:01 -0400

          From comp.compilers

Related articles
HLL design (fermineutron) (2006-10-21)
Re: HLL design (glen herrmannsfeldt) (2006-10-21)
Re: HLL design (Pascal Bourguignon) (2006-10-21)
Re: HLL design (Hans-Peter Diettrich) (2006-10-21)
Re: HLL design (Dmitry A. Kazakov) (2006-10-21)
Re: HLL design (Wolfram Fenske) (2006-10-21)
Re: HLL design (Hans-Peter Diettrich) (2006-10-21)
Re: HLL design (fermineutron) (2006-10-21)
Re: HLL design (Daniel C. Wang) (2006-10-24)
Re: HLL design ( (2006-10-24)
Re: HLL design (Bjarke Walling) (2006-10-24)
Re: HLL design (DavidM) (2006-10-24)
Re: HLL design (Hans-Peter Diettrich) (2006-10-26)
[1 later articles]
| List of all articles for this month |

From: Hans-Peter Diettrich <>
Newsgroups: comp.compilers
Date: 21 Oct 2006 22:05:01 -0400
Organization: Compilers Central
References: 06-10-080 06-10-083
Keywords: design, performance
Posted-Date: 21 Oct 2006 22:05:01 EDT

glen herrmannsfeldt wrote:

> If a compiler can determine at compile time that, for example, a loop
> variable can't go outside the array, or can test the loop conditions
> once instead of each time, it could be faster. I believe some
> compilers do that, but I don't know that any language includes it in
> the language definition.

Delphi example:

for i := low(ar) to high(ar) do

Here the compiler knows that i will always be within the array bounds.
low() and high() are compiler magics, which determine the bounds of
either static or dynamic arrays, or of other enumeratable or ordinal
types. The loop index must be a local variable (no aliasing), and cannot
be changed programmatically inside the loop. The implementation can use
an loop down-counter, instead of an index, and an pointer to the
elements. So the resulting code can be as fast as the same (but unsafe)
implementation in C.

[The IBM PL.8 project also did a lot of work on optimizing away bounds
checks when the compiler could tell they weren't needed. Don't know
what became of that work. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.