#PB_Any query
#PB_Any query
I know that you can specify the same id for a window and a gadget, however, if I use #PB_Any for both windows and gadgets, will the numbers generated ever overlap, or will they be unique?
Re: #PB_Any query
I am pretty sure they would be unique because I am reasonably sure that #PB_Any returns a pointer (for internal PB use).
I may look like a mule, but I'm not a complete ass.
Re: #PB_Any query
I was also thinking on the same lines. I do hope so! Fred? Freak? Please pipe up 
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: #PB_Any query
What difference does it make? Creating window 0 and gadget 0 and image 0 in the same program presents no problems - why would identical #PB_Any values for different object types be a concern?
BERESHEIT
Re: #PB_Any query
Because I'm building a unique id list, and I want to know if I have to roll my own id generator, or if the #PB_Any will do it regardless.
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: #PB_Any query
afaik #PB_Any is a constant with a value of -1. To use the #PB_Any generator you'd have to actually create an object, no? What, then free it? Seems simpler to use a map. A map enforces uniqueness and it's fast.
BERESHEIT
Re: #PB_Any query
You misunderstand, it's not for maps - it's for a hierarchical tree building, if I have a window and a gadget of the same id, then working out who the children are or who the parent is will get very awkward.
As I said - if using #PB_Any will get me a unique value regardless if it's assigned to a window or a gadget, then I'll just use that, otherwise, I'll use my own unique id generator. I just need to know if I am going to be doing that or not.
As I said - if using #PB_Any will get me a unique value regardless if it's assigned to a window or a gadget, then I'll just use that, otherwise, I'll use my own unique id generator. I just need to know if I am going to be doing that or not.
Re: #PB_Any query
Nevermind
Last edited by Matt on Sun Dec 06, 2009 6:04 pm, edited 1 time in total.
Re: #PB_Any query
Can you correct me? Cause then I don't know 
- Arctic Fox
- Enthusiast

- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
Re: #PB_Any query
This post by freak may be of interest
http://www.purebasic.fr/english/viewtop ... 16#p284316
http://www.purebasic.fr/english/viewtop ... 16#p284316
Re: #PB_Any query
Ahhh perfect! Thanks Arctic Fox, the first line confirmed what I and srod suspected - the values are indeed memory addresses, therefore I can guarantee that they will be unique 
