On Feb 19, 2009, at 10:29 AM, Leo Singer wrote:
I would rather not dynamically allocate that particular array because
the Cocoa application I am developing is simply a wrapper for a cross
platform C++ project.  This particular project has to manage a number
of different resources, including an SQLite database connection, an
open file, and a serial port device.  In order to keep error handling
as simple as possible, I have made heavy use of the RIAA pattern.  If
a serial port error occurs, for example, an exception gets thrown.  As
a result, the objects representing both the database and the open file
go out of scope, and their resources are released.

It's not hard to write a wrapper object for the malloc() block that calls free() when destructed. That would work just like your database wrapper object and your file wrapper object.


--
Greg Parker     gpar...@apple.com     Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to