Not everything is a nail...
Not everything is a nail...
Posted Jan 25, 2011 9:38 UTC (Tue) by paulj (subscriber, #341)In reply to: Not everything is a nail... by daglwn
Parent article: Sobotka: Why GIMP is inadequate
Posted Jan 25, 2011 16:06 UTC (Tue)
by jrn (subscriber, #64214)
[Link] (4 responses)
Posted Jan 25, 2011 16:41 UTC (Tue)
by etienne (guest, #25256)
[Link] (1 responses)
Posted Jan 25, 2011 22:18 UTC (Tue)
by daglwn (guest, #65432)
[Link]
RAII is about MUCH more than memory.
Posted Jan 26, 2011 12:32 UTC (Wed)
by paulj (subscriber, #341)
[Link] (1 responses)
C++ has implicit calls to constructors and destructors, which tie in to scoping. C doesn't have that, true, and requires explicit construction and destruction (you can still hide destruction behind refcounting, obv). It's often bad practice and/or a sign of a (quick)? hack when C code uses automatic allocating for non-trivial, composite objects.
Whether language support for implicit ctor/dtors tied with scoping is required for a practice to be called RAII, I don't know. I guess to a C++ person it does. Still, the general sentiment of RAII seems more widely applicable than C++.
Posted Jan 26, 2011 19:52 UTC (Wed)
by daglwn (guest, #65432)
[Link]
This gets to be impossible if the exit points are not known statically. C++ exceptions are a classic example but since some seem to think the C++ exception model is broken, I will emphasize that the problem is NOT solved by eliminating exceptions. One still has to cover all exit points with cleanup code.
Perhaps a better term for this would have been "resource ownership is object lifetime."
Not everything is a nail...
Not everything is a nail...
Maybe the real problem is that your "autoptr" is not able to manage an object in the stack, but you need an "autoptr" because one method has such an argument.
Not everything is a nail...
Not everything is a nail...
Not everything is a nail...
