[fpc-pascal] Problems with assigning pointers
dhkblaszyk at zeelandnet.nl
dhkblaszyk at zeelandnet.nl
Tue Apr 10 18:08:04 CEST 2012
I have some issues when assigning a pointer to a pointer variable.
Consider this:
TVertex = record
x: double;
y: double;
end;
PVertex = ^TVertex;
TEdge = record
v1: PVertex;
v2: PVertex;
end;
I have assigned a value to a vertex variable. In my code I have an
array of TEdge. When I try to assign a vertex to the edge element in the
array the x value suddenly is changed to 3e-308 (or something similar).
I don't understand why, perhaps someone could help me to figure this
out.The code I'm using to assign the value is shown below. To my
knowledge assigning a pointer this way is perfectly legal not?
procedure add_edge(v1, v2: PVertex);
begin
inc(edge_count);
SetLength(edge_list, edge_count);
edge_list[edge_count - 1].v1 := v1;
//
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120410/b3420f2f/attachment.html>
More information about the fpc-pascal
mailing list