Wireshark mailing list archives

Re: [Wireshark-commits] rev 35975: /trunk/epan/dfilter/ /trunk/epan/dfilter/: dfilter-macro.c dfilter.c


From: Jeff Morriss <jeff.morriss.ws () gmail com>
Date: Thu, 17 Feb 2011 09:27:21 -0500

Guy Harris wrote:
On Feb 17, 2011, at 12:25 AM, Stig Bjørlykke wrote:

On Thu, Feb 17, 2011 at 9:15 AM,  <guy () wireshark org> wrote:
 OK, let's try a couple more explicit checks against NULL, to see whether
 that de-confuses Microsoft's code analyzer.
Do we really want such changes?
Personally I think it makes the code harder to read.

Some think

        if (a) {
                ...
        }

is easier to read, others think

        if (a != NULL) {
                ...
        }

And some people think

        if (NULL == a) {
                ...
        }

is a good way of coding since a typo like (NULL = a) wouldn't compile.

But (at least for me) that really is unreadable! (And finding typos like the above is, in my mind, something for the compiler to warn about.)

It would be nice if the code analyzer bug in question didn't exist,
but the output of the code analyzer looks useful enough that I'd prefer
not to have to remember which "dereferecing a null pointer" complaints
are bogus every time I look at the code analyzer output.

I imagine there are going to be a LOT of "if (a)" checks in 2 million LOC. Do we really want to change them all?
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: