It is currently Sat Jan 23, 2021 7:47 am

All times are UTC + 1 hour

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: a few questions about optional map params, console, etc
PostPosted: Fri Dec 13, 2019 4:03 pm 

Joined: Wed Aug 28, 2019 1:01 pm
Posts: 112
Hi all :)

I would appreciate it so much if any of you could help demystify a few more things:
1. What exactly needs to be freed manually?
I know anything that is allocated manually also needs to be freed manually, and also functions that work with buffers often tell you to free the memory when you don't need it anymore, but what else do I have to free myself?
I've read a post about manually freeing strings in the structure, is that something we still have to do?
Also I've read how you're supposed to manually free dynamically added map elements...
If I have a structured array/list/map, is removing an element enough, or do I have to free/clear the structure it's attached to?
I'd appreciate if anyone could offer clarification.

2. Is it possible to have optional map procedure arguments?
I tried
newMap myMap.myStruct()
; add elements
procedure test(map m.myStruct()=myMap())

but it didn't like that.
I also wonder if there's a way to accept all types of array/map/list as a procedure argument like internal pb functions do?

3. Is there a way to prevent my win32 program from killing itself when a console opened with openConsole() is closed by user and (if possible) catch the closed event?

if the user closes the console, the program ends as if the end keyword was used.

4. What's the best way to pass structures to a threaded procedure?
Which of these ways is better, or is there a better way all together? I assume the second one would need freeing while the first one wouldn't?
Structure arg
Procedure test(*a.arg)
Debug *a\i
Debug *a\s
; first
t1=CreateThread(@test(), a)
; second
t2=CreateThread(@test(), *a)
Until Not IsThread(t1) And Not IsThread(t2)


Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour

Who is online

Users browsing this forum: No registered users and 35 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye