Re: I suppose the idea of classes and inheritance is



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
.



Relevant Pages

  • What can Brown do for you? (was: Re: AMC: Crud??)
    ... seemed like Josh, Jamie, JR. ... was involved in a lot of crud. ... characters saying things like "you shredded our life together," "you ... heard anyone in real life use the word "shred" in that way. ...
    (rec.arts.tv.soaps.abc)
  • Re: AMC: Crud??
    ... seemed like Josh, Jamie, JR. ... was involved in a lot of crud. ... characters saying things like "you shredded our life together," "you ... heard anyone in real life use the word "shred" in that way. ...
    (rec.arts.tv.soaps.abc)
  • Re: Uncanny X-Men #462
    ... > Too often insane characters are used to justify things because they're ... much about seeing Jamie so often lately, he shunted them into the House of M ...
    (rec.arts.comics.marvel.xbooks)
  • Re: MYSQL - ADO Insert problem - Help please
    ... in 50 there - seems that your ODBC driver detect the field size ... > I use an ODBC-Connection with DELPHI to insert new Items in the table. ... > "Text12345" (9 characters) ... > If the biggest entry is 20 characters long, it will be truncated to 20. ...
    (borland.public.delphi.database.ado)
  • Re: Displaying graphics characters
    ... Those characters are Unicode, ... which does not display properly with native Delphi controls. ...
    (comp.lang.pascal.delphi.misc)