Hi Frederic,

> Yes, I am afraid. This code construction show up in the code from time to
>  time and we have to provide a replacement. I think the best approach is to
>  use an auto_ptr.
> 
> std::auto_ptr<char> buf( new char[len] );
> 
> in order to be exception safe.

For array allocations, you need to take care that the array is 
deallocated using the array delete [] operator, i.e.

        char *buf = new char[len];
        delete [] buf;

Using an auto_ptr<char> is incorrect in this situation, because it will
deallocate using the non-array delete operator. You should use 
boost::scoped_array (or boost::shared_array if it is to be reference counted)
instead.

Regards,
        Manuel

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to