So should I take this to mean, that in GPC, a pointer must point to the exact data type? Meaning a Pointer to a string40 cannot point to a string15 or point to any lesser string than a string40, basically?
Adam
-----Original Message----- From: Maurice Lombardi [mailto:Maurice.Lombardi@ujf-grenoble.fr] Sent: Monday, February 26, 2001 9:36 AM To: Oldham, Adam Cc: 'gpc@gnu.de' Subject: Re: Strings, Lengths, etc
"Oldham, Adam" a écrit :
Hey, the code I am having a problem with is more like:
TYPE PString = STRING[40]; pPString = ^PString;
VAR PPtr : pPString; ConsVers : String(15); BEGIN PPtr := @ConsVers; END.
test.pas:1425: assignment from incompatible pointer type
This code has worked with Turbo and SVS, but not GPC.
But the behaviour of gpc is logical in this case, TP and SVS are not.
Oldham, Adam wrote:
So should I take this to mean, that in GPC, a pointer must point to the exact data type? Meaning a Pointer to a string40 cannot point to a string15 or point to any lesser string than a string40, basically?
Not without tricks (type casts etc.). Since a pointer is writable, there's quite a good reason for that. (That's not GPC specific, BTW, it's a general rule of Pascal, being a strictly typed language.)
Frank