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. _______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
