Re: Does Fast Code units compile in D5 Standard ?



At 12:41:46, 28.08.2005, Anders Isaksson wrote:

> Nicholas Sherlock wrote:
> >
> > PIntegerArray=^array[0..0] of integer; (Or possibly ^array of
> > integer).
>
> This one has the problem that you have to turn off range-checking when
> using it. By declaring
>
> PIntegerArray = ^array[0..SOME_UPPER_BOUND] of integer;
>
> you can leave range-checking on.

Agreed. I used to be a proponent of the [0..0] variety, but decided that
[0..SOMETHING_BIG] is usually safer to use, since you can leave
range-checking intact.

I think range and overflow checking should always be on, also in
production code.

SOMETHING_BIG can be anything suitable, up to

(MaxInt - 1) div SizeOf(Element)

I usually use $FFFF or $FFFFFF, which will do for most applications.
--
Rudy Velthuis [TeamB] http://velthuis.homepage.t-online.de

"A narcissist is someone better looking than you are."
- Gore Vidal
.



Relevant Pages