View Full Version : PascalScript pointers?
I just want to make sure before going into a fruitless search. Are pointers supported by simba?
Frement
03-26-2012, 12:07 PM
I just want to make sure before going into a fruitless search. Are pointers supported by simba?
As far as I know, if you use Lape, you can have pointers, but PascalScript does not support them.
Markus
03-26-2012, 12:10 PM
Only to procedures, and only in a limited fashion.
so I believe linked lists for now is out of the question for simba usage, right? :(
masterBB
03-26-2012, 02:57 PM
srl will go full lape in the near future. Just use lape for now.
edit:
I can't seem to get a linked list working in lape as you can't create a next or previous pointer of the type node within a record. But maybe I'm doing it wrong.
Markus
03-26-2012, 03:27 PM
Try it of type pointer then typecast the doodle out of it.
mixster
03-26-2012, 05:08 PM
type
PItem = ^TItem;
TItem = record
value: Integer;
next: PItem;
end;
masterBB
03-26-2012, 05:28 PM
You are a genius.
edit:
Markus typecast I used:
program new;
type
Node = record
value: String;
next: pointer;
end;
var
n1,n2:Node;
begin
n1.value := 'tada';
n2.value := 'hoi';
n1.next := @n2;
writeln(Node(n1.next^).value);
end.
You are a genius.
edit:
Markus typecast I used:
program new;
type
Node = record
value: String;
next: pointer;
end;
var
n1,n2:Node;
begin
n1.value := 'tada';
n2.value := 'hoi';
n1.next := @n2;
writeln(Node(n1.next^).value);
end.
Thanks everyone. Code works like a charm!
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.