Re: Something that really annoys me in Delphi ...

From: Rob Kennedy (.)
Date: 01/07/04


Date: Wed, 07 Jan 2004 16:49:28 -0600

Maarten Wiltink wrote:
> ... enforcing the invalidity of calling Succ(High(.)) requires a
> range check, and due to technical limitations this means having range
> checking enabled globally.

Well, you could just enable range checking locally. Something like this:

{$R+}
NextVal := Succ(CurrentVal);
{$R-}

There are known bugs regarding range checking and overflow checking with
the compiler-magic functions like Inc and Succ, though. As I recall,
they don't generate errors quite as consistently as conventional
arithmetic operations do.

-- 
Rob