freeing resources
Posted Feb 11, 2008 3:26 UTC (Mon) by
pflugstad (subscriber, #224)
In reply to:
It's not a mistake to ban goto... it's not a mistake to keep it... by filipjoelsson
Parent article:
Interview: Mark "Markey" Kretschmann (Not the Gentoo Weekly News)
Are you looking for RAII?
I use it quite often for things like mutexes, but it can be used in
many other situations - any time you hold a resource in a function
that must be cleaned up when the function exits, including when throwing
an exception.
It's a fairly common design pattern for C++ these days - I think I started seeing it a year or two ago...
(
Log in to post comments)