Henning, I don't know about calling the usage of raw pointers "dangerous and evil". I do, however, agree smart pointers can definitely help us in some of our goals.
Since the current code base does use raw pointers, and has it's own ref-counting mechanism, I'd like to initiate a design phase before going deep into changes. I will release an RFC to this mailing list as soon as I can get it written, and would like to hear your thoughts over it. There I will list the exact types of memory management tasks we are facing, and suggest a way of approaching this. This should answer your questions, and I hope you'll be able to take this task (we have another person looking into this, and hopefully there will be several others, so we could get this done properly and quickly). The macros for new and delete are there mostly for two reasons - 1. To support the internal ref-counting mechanism (_CLNEW and _CLDECDELETE pairs), and 2. For better cross-platform support (allocation and deletion of arrays, strings [TCHAR and char] etc). Obviously, those will probably be deprecated by the move to smartpointers... Itamar. -----Original Message----- From: Henning Meyer [mailto:tutm...@gmail.com] Sent: Wednesday, December 09, 2009 4:55 AM To: clucene-developers@lists.sourceforge.net Subject: Re: [CLucene-dev] CLucene Memory Management Hi Itamar, it's true - boost:shared_ptr might be overkill in many cases. But usage of raw pointers is dangerous and evil. Please use boost::scoped_ptr instead (or std::auto_ptr if copies are needed). But never ever use raw pointers. Especially since I've seen that many of the topics discussed here are around memory leaks I have to make a strong point for the use of smartpointers. Btw: boost::scoped_ptr should result in absolutely no performance penalty - you just get more safety and also exception handling for free... Where would be a good point to start with help (e.g. which parts should be ported to smartpointers first)? Would you like to always use boost::shared_ptr in API-functions or should one think of std::auto_ptr instead (thus explicitly taking ownership)? Btw: Why are there macros for new and delete in CLucene? Henning ---------------------------------------------------------------------------- -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ CLucene-developers mailing list CLucene-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/clucene-developers ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ CLucene-developers mailing list CLucene-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/clucene-developers