Re: I suppose the idea of classes and inheritance is
- From: erewhon@xxxxxxxxxx (J French)
- Date: Fri, 13 Oct 2006 06:28:40 GMT
On Thu, 12 Oct 2006 11:19:47 -0700, Jamie
<jamie_ka1lpa_not_valid_after_ka1lpa_@xxxxxxxxxxx> wrote:
<snip>
While the String is 'terminated' with #0, attempting to get at that
index produces a Range Error if Range Checking is turned on.
procedure TForm1.Button1Click(Sender: TObject);
Var
S :String;
C :Char;
begin
{$R+}
S := StringOfChar('a', 10);
C := S[ Length( S ) + 1 ];
ShowMessage( IntToStr( Ord(C) ) );
end;
procedure TForm1.Button1Click(Sender: TObject);
var
S:String;
X:Integer;
C:char;
begin
C:= #$FF;
S := 'Test';
X := 5;
C := S[X];
if C = #0 then Beep;
end;
the above test does not generate a range error.
test your findings first please.
You have not got Range Checking turned on
- either turn it on via Project/Options or use {$R+}
- then try running the code
IMO Range Checking should always be on by default, and only turned off
under very defined circumstances.
--
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5
.
- 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
- 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: try - except
- 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):