Re: [PATCHES] Bad bug in fopen() wrapper code

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCHES] Bad bug in fopen() wrapper code
Дата
Msg-id 24827.1159883943@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCHES] Bad bug in fopen() wrapper code  ("Zeugswetter Andreas DCP SD" <ZeugswetterA@spardat.at>)
Список pgsql-hackers
"Zeugswetter Andreas DCP SD" <ZeugswetterA@spardat.at> writes:
> "If successful, _setmode returns the previous translation mode. A return
> value of -1 indicates an error"

> So, shouldn't we be testing for -1 instead of < 0 ?

I think the usual convention is to test for < 0, unless there are other
negative return values that are legal.  This is doubtless a silly
cycle-shaving habit (on nearly all machines, test against 0 is a bit
more compact than test against other constants), but it is a widespread
habit anyway, and if you sometimes do it one way and sometimes another
you just create a distraction for readers.

            regards, tom lane

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

Предыдущее
От: Zdenek Kotala
Дата:
Сообщение: PG qsort vs. Solaris
Следующее
От: mark@mark.mielke.cc
Дата:
Сообщение: Re: Faster StrNCpy