On Sat, 27 Sep 2003 16:12:49 +0200 (CEST) Robert Vazan <[EMAIL PROTECTED]> wrote:

RV> I think we can all agree that smart pointers would be much nicer solution
RV> than IncRef and DecRef.

 Actually, they're not a replacement to IncRef and DecRef but a complement
to them, of course, as we want to use shared_ptr (in boost parlance) rather
than std::auto_ptr with its weird semantics.

RV> I am around here for very short time and this topic
RV> has been certainly discussed before, so why not smart pointers?

 In fact, we do have smart pointers :-) Look at MObject.h and
DECLARE_AUTOPTR_XXX() macros. True, not all the code uses them and we don't
have a clear convention for the functions returning a pointer (they should
return an auto ptr instead...).

RV> I am asking because I see how often I leave around (probably harmless)
RV> uncounted pointers. There may be several objections to smart pointers
RV> (using templates, include dependencies, unnecessary counter trashing, back
RV> links, compatibility with existing code, pointers from libraries), but I
RV> can always find some nice solution for any of these problems.

 There are 2 problems:

1. use of macros instead of templates
2. use of intrusive ref counting (only works with MObject) rather than
   external (like boost::shared_ptr)

For (1) we could try using templates instead but I'd like to see the
comparison of compiling time after replacing MObject.h macros with
templates. For (2), it's probably not a big problem in M. Although I would
(and do, in fact) use boost::shared_ptr<> in a new project, in M everything
does derive from MObject anyhow, so it's not such a big problem.

 Regards,
VZ



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-Developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-developers

Reply via email to