------- Comment #8 from fang at csl dot cornell dot edu 2007-08-09 02:54 ------- Please forgive a wee bit more noise on this matter: (Yes, I know this is resolved invalid)
If you really insist on using a pointer instead of a valarray or vector, I suggest taking a technique from the STL and using an auto_array class template that delete []'s an array-allocated pointer automatically upon destruction (exception-safe too). Overload for member operator [] to do pointer arithmetic, for convenience. Taking the paradigm further, you can devise things like boost::shared_array (TR1?), or some sort of policy-driven pointer-class that performs The Appropriate Action (TM) upon destruction. If you're extremist, like me, and want to find/substitute *all* bare occurrences of operators new and delete (outside of certified pointer/array/vector classes), 'cpp | grep' for them, no g++ required. :) I can't remember the last time I botched any operation mismatch/typo/bug/error/unbalance. Of course, if you didn't actually make such an error, and the example was just a demonstration of your point, then I'm probably just preaching to the choir. [returns to lurking] -- fang at csl dot cornell dot edu changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fang at csl dot cornell dot | |edu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32984