Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Coffee corner » Thoughts about resource management
Re: Thoughts about resource management [message #30830 is a reply to message #30807] Mon, 24 January 2011 14:34 Go to previous messageGo to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Mindtraveller wrote on Sun, 23 January 2011 10:28

You of course know "everything belongs somewhere" approach. If you tried it, you most probably know it as simple and effective way of getting rid of resource management problems. Simply speaking, you equalize visibility of object and period of its life by defining resource as stack object of parent class.
This works good for simple cases where resource lives constantly, starting with constructor of its parent until parent destructor is called.
But sometimes we meet more complex scenario, when resource is destroyed and re-created many times while program is working. We of course have Ptr/Pte wrappers. And I use them havily in these cases. Of course we may use public parent member functions which manage this resource for it not to violate our general approach.
But in my opinion we should discuss "everything belongs somewhere" for complex scenarios and widen U++ manual a little. Because complex scenarios is where smart pointers live, and we have to avoid mixing them with "U++ style".



Have you read this topic ? Smile

[Updated on: Mon, 24 January 2011 14:35]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Antigrain author on text rasterisation
Next Topic: The power of Waf
Goto Forum:
  


Current Time: Fri Jul 18 03:30:56 CEST 2025

Total time taken to generate the page: 0.04051 seconds