Hey,

>>
>> WAE is enabled in my autogen.lastrun for master sources. I just updated and
>> had this during compilation:
>> /home/julien/compile-libreoffice/libo/sc/source/core/tool/rangenam.cxx: In
>> member function ‘void ScRangeData::SetCode(ScTokenArray&)’:
>> /home/julien/compile-libreoffice/libo/sc/source/core/tool/rangenam.cxx:642:50:
>> error: ‘auto_ptr’ is deprecated (declared at
>> /usr/include/c++/4.7/backward/auto_ptr.h:87)
>> [-Werror=deprecated-declarations]
>> cc1plus: all warnings being treated as errors
>>
>> Here are the lines:
>>     640 void ScRangeData::SetCode( ScTokenArray& rArr )
>>     641 {
>>     642     ::std::auto_ptr<ScTokenArray> pOldCode( pCode);     // old pCode
>> will be deleted
>>     643     pCode = new ScTokenArray( rArr );
>>     644     InitCode();
>>     645 }
>>
>>
>> Could it be replaced by a non deprecated function (I don't know between
>> std::shared_ptr, std::unique_ptr or boost functions)?
>
> usually can be replaced with boost::scoped_ptr.
>
> but in this case i wonder, what purpose does pOldCode serve?
> why isn't pCode some kind of smart pointer?
>

Replace it with boost::scoped_ptr. The idea here is that the auto_ptr
keeps the object until the end of the function and therefore we have
no memory leak in line 643.

Calc core normally does not use smart pointers because with million or
billion of calls that can happen in a bigger calc document the
overhead of smart pointers is not always insignificant.

Regards,
Markus
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to