Page 1 of 1

Posted: Sun Feb 09, 2003 6:56 pm
by BackupUser
Restored from previous forum. Originally posted by SimpleMind.

Hi,

Has someone an solution to pass a linked list to a procedure. Everything I tried crashes . I have a function that does its processing on lists it is passed by its parameter list. If this is not the case than I'll have to make several copies of the same function each with another name and list name in it :cry:.

TIA

SimpleMind,

Perfection is reached not when there is no longer anything to add,
but when there is no longer anything to take away. (A. Saint-Exupery)

- Registered PureBasic Coder. -

Posted: Sun Feb 09, 2003 7:04 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

Linked Lists are Global. So you can't pass them to a procedure.

Timo

Posted: Sun Feb 09, 2003 7:50 pm
by BackupUser
Restored from previous forum. Originally posted by SimpleMind.

Yes, I know.:) But I'm very curious that there might be a glorius person who found a solution!

SimpleMind,

Perfection is reached not when there is no longer anything to add,
but when there is no longer anything to take away. (A. Saint-Exupery)

- Registered PureBasic Coder. -

Posted: Mon Feb 10, 2003 12:57 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
Originally posted by SimpleMind

Yes, I know.:) But I'm very curious that there might be a glorius person who found a solution!
You could move to the first item in the list and pass a pointer to that, but you cannot pass a pointer to the base of the list. As far as my experimentation goes, I don't think you can get access to the list base in an easy way.

You could also check out my linked list re-implementation on Pauls resources site. It's basically the same as the PB stuff but you have full control over everything and you can put linked lists inside structures. Of course, it will be slower.


--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + all updates, PB3.51, Ed3.53)

Posted: Mon Feb 10, 2003 7:29 pm
by BackupUser
Restored from previous forum. Originally posted by SimpleMind.

Thanks Tinman, I'll take a look. But nevertheless you set me on an idea. I could isolate only those actions that rely on pointers and put that in a procedure.

SimpleMind,

Perfection is reached not when there is no longer anything to add,
but when there is no longer anything to take away. (A. Saint-Exupery)

- Registered PureBasic Coder. -