Got an idea for enhancing PureBasic? New command(s) you'd like to see?
-
User_Russian
- Addict

- Posts: 1520
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Post
by User_Russian »
From helpsafely used to determine if a list is empty or not.
Using the function is not safe! The application is crashing.
Code: Select all
DisableDebugger
NewList x()
FreeList(x())
MessageRequester("", Str(ListSize(x())))
-
normeus
- Enthusiast

- Posts: 470
- Joined: Fri Apr 20, 2012 8:09 pm
-
Contact:
Post
by normeus »
if you might use the list again use:
It frees memory like FreeList() but the List reference is still available. FreeList() makes it like the variable never existed.
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
-
infratec
- Always Here

- Posts: 7587
- Joined: Sun Sep 07, 2008 12:45 pm
- Location: Germany
Post
by infratec »
if a list is empty or not
After FreeList() you have no list. So it is correct.
It is not a procedure to test if a list is available or not.
-
infratec
- Always Here

- Posts: 7587
- Joined: Sun Sep 07, 2008 12:45 pm
- Location: Germany
Post
by infratec »
Maybe a FeatureRequest for IsList() is a good idea.
-
STARGÅTE
- Addict

- Posts: 2227
- Joined: Thu Jan 10, 2008 1:30 pm
- Location: Germany, Glienicke
-
Contact:
Post
by STARGÅTE »
I would prefer that ListSize() gives -1 if the list is not initialized, as it is the behavior for arrays.
-
Denis
- Enthusiast

- Posts: 778
- Joined: Fri Apr 25, 2003 5:10 pm
- Location: Doubs - France
Post
by Denis »
STARGÅTE wrote: Wed Oct 12, 2022 10:19 pm
I would prefer that ListSize() gives -1 if the list is not initialized, as it is the behavior for arrays.
+1
A+
Denis
-
Andre
- PureBasic Team

- Posts: 2137
- Joined: Fri Apr 25, 2003 6:14 pm
- Location: Germany (Saxony, Deutscheinsiedel)
-
Contact:
Post
by Andre »
Moved to 'Feature requests'