Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


On Fri, 2011-11-18 at 15:49 +0400, Ivan Timofeev wrote:
Hi Muthu,

18.11.2011 15:38, Muthu Subramanian K пишет:
That code is inside the constructor.
and the constructor sets the variable pUndoSet to NULL right on the top.
So, the if would always fail! Unless I am missing something. Looks too
trivial to be true ;)

I don't see any way to assign non-NULL value to pUndoSet prior to that 
if. Most likely we can remove it...

The code is correct either way.

One consideration is how far a suspicious-minded programmer
must look in order to set to rest the suspicion that there
might be a memory leak.  The original code answers the
question close to the `new` operator, and that is a
goodness.  The revised code is five lines shorter, and that
too is a goodness.  Within a constructor, I think I prefer
the second goodness; but that little more than habit.

Coincidentally, in another thread Stephan Bergmann argues
<http://lists.freedesktop.org/archives/libreoffice/2011-November/020843.html>
on broader grounds against the redundant assignment.  I look
forward eagerly to that discussion.

Terry.



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.