Re: I suppose the idea of classes and inheritance is
- From: Rob Kennedy <me3@xxxxxxxxxxx>
- Date: Sun, 15 Oct 2006 15:10:18 -0500
Jamie wrote:
J French wrote:On Sat, 14 Oct 2006 14:46:50 -0700, Jamie
<jamie_ka1lpa_not_valid_after_ka1lpa_@xxxxxxxxxxx> wrote:
<snip>
You must take me for something i just can't amagine ?
No, but you're making it difficult for me. I don't want to make this personal.
I have just cut and pasted your sample
- and as expected it gives a Range Check error on I := 5;
S2[I] := 'A';// Does not generate Range error !
Look Jamie, Rob and I are not making a personal attack, we are simply
stating that Delphi is expected to make a Range Check error when
accessing S[ Length(S) + 1 ]
Also that on our machines it DOES throw an error
KA-PLUNK!.
so what your trying to tell me that i have miles of
code that is wrong. bye for now.
If your code relies on accessing characters of a string that aren't in the range of that string, then yes, your code is wrong.
The valid range of characters for a string S is [1..Length(S)]. With range checking turned on, that range is enforced at run time. An ERangeError exception is raised when accessing any index greater than Length(S) or less than 1.
There is one exception to that rule. With WideString values, Delphi misinterprets the length field as a character count when it's really a byte count, so accessing characters in the range [1..2*Length(s)] (or [1..2*Length(s)+1]) is allowed, even though the only safe range is [1..Length(s)]. This is chronicled in QC 9425.
--
Rob
.
- Follow-Ups:
- References:
- I suppose the idea of classes and inheritance is
- From: Genome
- Re: I suppose the idea of classes and inheritance is
- From: Maarten Wiltink
- Re: I suppose the idea of classes and inheritance is
- From: Genome
- Re: I suppose the idea of classes and inheritance is
- From: Jamie
- Re: I suppose the idea of classes and inheritance is
- From: Maarten Wiltink
- Re: I suppose the idea of classes and inheritance is
- From: Jamie
- Re: I suppose the idea of classes and inheritance is
- From: J French
- Re: I suppose the idea of classes and inheritance is
- From: Jamie
- Re: I suppose the idea of classes and inheritance is
- From: J French
- Re: I suppose the idea of classes and inheritance is
- From: Jamie
- Re: I suppose the idea of classes and inheritance is
- From: J French
- Re: I suppose the idea of classes and inheritance is
- From: Jamie
- Re: I suppose the idea of classes and inheritance is
- From: Rob Kennedy
- Re: I suppose the idea of classes and inheritance is
- From: Jamie
- Re: I suppose the idea of classes and inheritance is
- From: J French
- Re: I suppose the idea of classes and inheritance is
- From: Jamie
- I suppose the idea of classes and inheritance is
- Prev by Date: Re: I suppose the idea of classes and inheritance is
- Next by Date: Re: Adding combobox to grid?
- Previous by thread: Re: I suppose the idea of classes and inheritance is
- Next by thread: Re: I suppose the idea of classes and inheritance is
- Index(es):
Relevant Pages
|