Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Do I need to delete the Command objects? (http://www.chiefdelphi.com/forums/showthread.php?t=109481)

Itamar 11-11-2012 10:57

Do I need to delete the Command objects?
 
Ahoy ahoy!

This year our team decided to work with C++. I was reading this excellent pdf when a thought occoured to me: do I need to clear the memory of all the Command instances I create? If so, will it work to simply write "delete this;" at the "end" method?

Or maybe creating instances during runtime is not right at all, and all Commands should be created at the beginning and re-used while the robot runs?

Thank you,
Itamar

mythbusterma 25-11-2012 21:08

Re: Do I need to delete the Command objects?
 
It seems that by the way they implement commands, the commands automatically lose scope after they finish executing, and hence are deleted.


All times are GMT -5. The time now is 13:26.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi