On 06/09/2013 08:32 AM, Matteo Casalin wrote:
Hi Caolán,
first of all thanks for the rationale in your revert (commit
8a3f61c42b7dfd7221bd7bc9d9a5a70c052a0bf5), I understand it is not
mandatory but it really helps.
I introduced those checks while visually scrolling through code for a
previous commit. Is there a rule of thumb on whether these checks are
required or not (and where), or should I just rely on reports from code
analysis tools?
First of all, introducing null pointer checks without understanding the
code is never a good idea. If you do not understand the code in
question, you neither know (a) whether the pointer is intended not to be
null here and can only be so due to a programming error somewhere else
(so the fix should also go somewhere else), nor (b) what to do in the
else branch.
And in the special case of a pointer obtained from plain new, it can
never be null anyway, as already explained by Caolán.
Stephan
Looking back to the code, I completely misunderstood the aim of the same check after one of the two
that I introduced.
Thanks for the clarification.
Matteo
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice
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.