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 |
Дата | |
Msg-id | 200007070043.CAA20793@hot.jw.home обсуждение исходный текст |
Ответ на | 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
|
Список | pgsql-hackers |
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) > > [...] > > Up till just now, ruleutils.c contained code like this: > > bool tell_as = FALSE; > > /* Check if we must say AS ... */ > if (!IsA(tle->expr, Var)) > tell_as = strcmp(tle->resdom->resname, "?column?"); > > [...] Yeah, blame me for that one. Oh boy. Originally I wrote ruleutils.c as a proof that rewrite rules "can" tell what the original rule (or view) looked like. Someone called it a "magic piece of software" and we adopted it as a useful thing to dump views and rules (what we wheren't able before). Now you blame me for it's uglyness. Well done! I was so proude beeing able to show how much I knew about rewrite rules by coding a reverse interpreterfor them. Just that I was too lazy to code it in a good style. Remind me on it if I ever ask "what should I do next". :-) Jan PS: I'm sure Tom can read between the lines what I really wanted to say. For anyone else: The functionality of ruleutils.cis checked in the regression suite. None of the ports reported problems so far, so the requested stylefixes are more or less of cosmetic nature by now. I'm more than busy doing other things actually. If someone else want's to learn abount the internals of rules, touch it and become responsible for it. -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #
В списке pgsql-hackers по дате отправления: