This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Of Bounties and Mercenaries


[Alexandre Oliva]
> It doesn't take care of cycles, though, and they're quite
> pervasive in GCC.

Cycles are the standard objection to my argument.

It also completely misses the point.  I advocate using shared_ptr (a
reference counted pointer) to hold noncopyable resource managers - that
doesn't introduce cycles.

If you have a data structure which has cycles, then you should encapsulate
it.  For example, std::list is a doubly linked list and hence has cycles of
pointers inside of it.  But the user of std::list doesn't have to know or
care about that.

Manual memory management is a reasonable thing to do, as long as it stays
confined to the constructor, destructor, and methods of a single class that
needs to do something exotic.  (Of course, the same class can use vectors
and whatnot to do mundane things.)

Stephan T. Lavavej
http://nuwen.net




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]