Re: [fpc-pascal] Re: Problems with assigning pointers

2012-04-11 Thread dhkblaszyk
Hi Sven en Vincent, Thanks for your hints. Indeed the dynamic array was the problem. I have now replaced it by a linked list of verts/edges/faces. It now works perfectly. Regards, Darius On 11 apr '12, Sven Barth wrote: > Am 10.04.2012 22:16, schrieb Vincent Snijders: > >> Op 10 april

Re: [fpc-pascal] Re: Problems with assigning pointers

2012-04-11 Thread Jürgen Hestermann
Vincent Snijders schrieb: >> type >> TVertex = record >>x: double; >>y: double; >> end; >> PVertex = ^TVertex; >> >> TEdge = record >>v1: PVertex; >>v2: PVertex; >> end; . . >> Result := @vert_list[vert_count - 1]; > > I think this is not correct. If you increase the size of

Re: [fpc-pascal] Re: Problems with assigning pointers

2012-04-11 Thread Sven Barth
Am 10.04.2012 22:16, schrieb Vincent Snijders: Op 10 april 2012 22:06 heeft Darius Blaszyk het volgende geschreven: Here's a minimal example that has the bug. First of all the first output is wrong as it says 0,50 instead of 20,50 (so the x item is overwritten). The second printed output diffe

Re: [fpc-pascal] Re: Problems with assigning pointers

2012-04-10 Thread Vincent Snijders
Op 10 april 2012 22:06 heeft Darius Blaszyk het volgende geschreven: > Here's a minimal example that has the bug. First of all the first output is > wrong as it says 0,50 instead of 20,50 (so the x item is overwritten). The > second printed output differs from the first, so again the x item is

Re: [fpc-pascal] Re: Problems with assigning pointers

2012-04-10 Thread Darius Blaszyk
Here's a minimal example that has the bug. First of all the first output is wrong as it says 0,50 instead of 20,50 (so the x item is overwritten). The second printed output differs from the first, so again the x item is overwritten. I'm clueless. program test; {$mode objfpc}{$H+} type TVert

[fpc-pascal] Re: Problems with assigning pointers

2012-04-10 Thread leledumbo
Can't reproduce with the following program: type TVertex = record x: double; y: double; end; PVertex = ^TVertex; TEdge = record v1: PVertex; v2: PVertex; end; var edge_count: LongWord = 0; edge_list: array of TEdge; procedure add_edge(v1, v2: PVertex); begin inc(