[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
CppCheckedDelete

(C++) boost::checked_delete

A checked version of delete supplied with the Boost C++ library.

To cite from http://www.boost.org/libs/utility/checked_delete.html:

The C++ Standard allows, in 5.3.5/5, pointers to incomplete class types to be deleted with a delete-expression. When the class has a non-trivial destructor, or a class-specific operator delete, the behavior is undefined. Some compilers issue a warning when an incomplete type is deleted, but unfortunately, not all do, and programmers sometimes ignore or disable warnings.

In other words, if you use a lot of forward declarations you should prefer to use boost::checked_delete.

Note that std::auto_ptr does NOT use a checked delete! When you really need a checked delete, use boost::scoped_ptr instead (but note that boost::scoped_ptr has a slightly different interface then std::auto_ptr).

Links

  • Boost's checked_delete documention:
http://www.boost.org/libs/utility/checked_delete.html

last edited (November 11, 2006) by bilderbikkel, Number of views: 1552, Current Rev: 2 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.