Re: Memo on coding practices: strcmp() does not yield bool
От
eisentrp@csis.gvsu.edu
Тема
Re: Memo on coding practices: strcmp() does not yield bool
Дата
Msg-id
Pine.LNX.4.21.0007070740300.12287-100000@eos05.csis.gvsu.edu
Ответ на
Список
Дерево обсуждения
Memo on coding practices: strcmp() does not yield bool Tom Lane <tgl@sss.pgh.pa.us>
Re: Memo on coding practices: strcmp() does not yield bool JanWieck@t-online.de (Jan Wieck)
Re: Memo on coding practices: strcmp() does not yield bool Tom Lane <tgl@sss.pgh.pa.us>
Re: Memo on coding practices: strcmp() does not yield bool Bruce Momjian <pgman@candle.pha.pa.us>
Re: Memo on coding practices: strcmp() does not yield bool eisentrp@csis.gvsu.edu
On Thu, 6 Jul 2000, Tom Lane wrote: > I've occasionally griped that I do not like the coding practice of > writing > if (strcmp(foo, bar)) > to mean > if (strcmp(foo, bar) != 0) Why not define a macro to avoid the urge to take shortcuts like that in the future? #define streq(a,b) (strcmp((a), (b))==0) This is guaranteed to yield 1 or 0, and it's very readable. -- Peter Eisentraut Sernanders vaeg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden
В списке pgsql-hackers по дате отправления