Re: [PATCH 17/25] avoid segfault when calling sanitize_string() on NULL

Subject: Re: [PATCH 17/25] avoid segfault when calling sanitize_string() on NULL

Date: Fri, 03 Jun 2011 12:24:23 -0700

To: Jameson Graef Rollins, Notmuch Mail

Cc: Daniel Kahn Gillmor

From: Carl Worth


On Sat, 28 May 2011 14:51:52 -0700, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> +    if (NULL == str)
> +	return NULL;

I haven't been blocking patches because of this, but can I please ask
everyone to not use the above style?

I understand that the above style is intended to generate a compiler
error in the case of the programmer mistyping '=' where '==' was
intended.

But I just can't stand this style.

It looks so unnatural to me to read "if some_value is some_variable"
instead of the natural "if some_variable is some_value".

Also, gcc is kind enough to warn ("suggest parentheses around assignment
used as truth value") in the case of "if (str = NULL)" anyway, so
there's no actual benefit to the unnatural style.

I really do want our code to be readable, and I think that little things
do make a difference.

Thanks for your attention, (and thanks for your patience if I seem off
my rocker).

-Carl
part-000.sig (application/pgp-signature)

Thread: