On 10 March 2011 09:47, Johannes Singler wrote: > The attached patch patch solves a conformance problem of the parallel mode > helper routine multiseq_partition. I have added a test case for that. > multiseq_selection has similar problems, but is unused, so I plan to remove > that completely (which might ask for renaming of the file and the test).
Please update the copyright date in the changed file as well. > Should I use unique_ptr (or alloca, or something similar) here for a better > exception safety (this routine is not parallel itself)? unique_ptr is C++0x only, auto_ptr would work. But I see other heap allocation in that function are already unguarded so there doesn't seem to be much point guarding one and not the others. How about defining a local RAII type (and combining the three allocations into one) e.g. struct _Guard { _DifferenceType* _M_ns; ~_Guard() { delete[] _M_ns; } } __guard = { }; __guard._M_ns = new _DifferenceType[__m*3]; _DifferenceType* __ns = __guard._M_ns; _DifferenceType* __a = __guard._M_ns + __m; _DifferenceType* __b = __guard._M_ns + 2*__m; _DifferenceType __l; That ensures the _Guard destructor will clean up on exiting the function, so you can remove the delete statements. and std::auto_ptr<_ValueType> __lmax; ... __lmax.reset(new _ValueType(__S(__i)[__a[__i] - 1])); etc.