StrPas question
From: Ian Hinson (pparagon_at_bigpond.net.au)
Date: 12/15/04
- Next message: Rob Kennedy: "Re: StrPas question"
- Previous message: AlanGLLoyd: "Re: Using dynamically created menus..."
- Next in thread: Rob Kennedy: "Re: StrPas question"
- Reply: Rob Kennedy: "Re: StrPas question"
- Reply: Thaddy de Koning: "Re: StrPas question"
- Reply: Ekkehard Domning: "Re: StrPas question"
- Maybe reply: Skybuck Flying: "Re: StrPas question"
- Maybe reply: Skybuck Flying: "Re: StrPas question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 15 Dec 2004 17:26:42 GMT
I kind of baffled why the StrPas function is so simple.
The SysUtils source for the StrPas function says:
function StrPas(const Str: PChar): string;
begin
Result := Str;
end;
I would have expected StrPas to make a *copy* of the source PChar so that
the program can then do with the source string whatever it wants after that.
Therefore, shouldn't the StrPas function instead look like this?
function StrPas(const Str: PChar): string;
begin
SetString(Result, Str, StrLen(Str));
end;
Maybe I'm just missing something in my understanding of Strings.
Or maybe the const parameter is achieving an extra step that I've
overlooked.
Could someone please clarify?
Thanks,
Ian.
- Next message: Rob Kennedy: "Re: StrPas question"
- Previous message: AlanGLLoyd: "Re: Using dynamically created menus..."
- Next in thread: Rob Kennedy: "Re: StrPas question"
- Reply: Rob Kennedy: "Re: StrPas question"
- Reply: Thaddy de Koning: "Re: StrPas question"
- Reply: Ekkehard Domning: "Re: StrPas question"
- Maybe reply: Skybuck Flying: "Re: StrPas question"
- Maybe reply: Skybuck Flying: "Re: StrPas question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|