Re: sparse (static analyzer) report

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: sparse (static analyzer) report
Дата
Msg-id 7648.1105776165@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: sparse (static analyzer) report  (Greg Stark <gsstark@mit.edu>)
Ответы Re: sparse (static analyzer) report  (Andrew Dunstan <andrew@dunslane.net>)
Re: sparse (static analyzer) report  (Greg Stark <gsstark@mit.edu>)
Список pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
>> Hmm.  Well, it showed the multiple incorrect uses of 0 as NULL in
>> dllist.c and other places, 

> Incidentally, while it may not be conformant to your style guidelines, use of
> the constant 0 compared to or assigned to a pointer is a perfectly valid ANSI
> spelling for NULL.

Absolutely.  But I agree that it is more readable to use NULL when you
mean a null pointer, and 0 when you mean an integer zero.  The C
standard may not distinguish these concepts, but I do ;-)

Something that I don't have a real strong feeling about isif (ptr != NULL)
versusif (ptr)
I've been known to write both.  Can anyone mount a good readability
argument for one over the other?

How about the inverse case,if (ptr == NULL)
versusif (!ptr)
Applying a boolean ! to a pointer seems a bit shaky to me, though
it's certainly a common locution.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: sparse (static analyzer) report
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [PORTS] 8.0.0rc4 / OpenBSD 3.6 / amd64 success