Hi,
Tamas Konkoly wrote 17 lines
I would like to know why don't work the first d declaration.
The second declaration work only well, because I checked it.
type TR=record
a,b,c:longint;
end;
var data:array[0..100]of TR;
procedure pp(var r:TR);
var d:^TR;
begin
; // << this is not compileable
(TR); // << this is compileable
end;
begin
pp(data[0]);
end.
This code is buggy, and shows bad coding too, IMO. The problem is that r is not an array. The easiest way to fix is some typecasts.
type PTR = ^TR;
d:=@(PTR(@r)[20]); // ugly;
IMO, the above code should look like this:
type PTR=^TTR;
TTR=record
a,b,c:longint;
end;
var data:array[0..100] of TTR;
procedure pp(r:PTR);
var d:PTR;
begin
;
end;
begin
pp(@data[0]);
end.
Hope this helps.
You can ask me in private mail in hungarian if needed.
Bye,
Charlie/iNQ (SceneCON -
http://scenecon.intro.hu)
.:%[ Cybernetic Hydraulic Android Responsible for ]%:.
.:%[ Logical Infiltration and Exploration ]%:.
.:%[ Member of TeamOS/2 Hungary ]%:.
.:%[ Member of Hungarian Amiga User Group ]%:.