I just try your method,it can work. thanks Mike - EMAIL IGNORED wrote: > Thomas Maeder wrote: > > > > Mike - EMAIL IGNORED <[EMAIL PROTECTED]> writes: > > > > > To prevent the problem, I always follow > > > a delete by clearing the pointer: > > > > > > delete [] a; > > > a = 0; > > > > > > Your cout will then result in an immediate, and obvious > > > crash, which can then be debugged. > > > > IMHO, better advice would be to not express ownership of a dynamically > > allocated resource through a "raw" pointer. Smart pointers are much > > better suited to that task. > > I certainly agree with this comment on the value of smart pointers. The > a = 0 technique is used within my smart pointers as insuance against > a coding error within the smart pointer itself. However, there are > still > occasional situations in which a raw pointer is the best available plan. > > Mike.
_______________________________________________ Help-gplusplus mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gplusplus
