Thread: [HACKERS] TRUE and true
Hello, I have a maybe-silly question. What makes us have both TRUE/true or FALSE/false as constants of bool? The following definitions in c.h didn't mess anything up. #define TRUE true #define FALSE false # NIL seems causing similar mess. regards, -- Kyotaro Horiguchi NTT Open Source Software Center
On Thu, Jun 22, 2017 at 2:09 PM, Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> wrote:
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
Hello, I have a maybe-silly question.
What makes us have both TRUE/true or FALSE/false as constants of
bool?
The following definitions in c.h didn't mess anything up.
#define TRUE true
#define FALSE false
+1
I don't know any policy about where to use TRUE and FALSE over true and false.
# NIL seems causing similar mess.
NIL is used for lists, while NULL is used for other pointers.
That may cause redundant, but at least there is clear policy.
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
On 6/22/17 07:09, Kyotaro HORIGUCHI wrote: > What makes us have both TRUE/true or FALSE/false as constants of > bool? Historical reasons, probably. I plan to submit a patch to phase out or remove TRUE/FALSE as part of a migration toward stdbool.h. So I suggest you use lower case and don't worry about the other ones for now. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
At Thu, 22 Jun 2017 15:35:13 +0300, Alexander Korotkov <a.korotkov@postgrespro.ru> wrote in <CAPpHfdtsF13YM1jbKCDBrdeC2Da5vs9Ca6sL4rwRj6=h1ACZgw@mail.gmail.com> > On Thu, Jun 22, 2017 at 2:09 PM, Kyotaro HORIGUCHI < > horiguchi.kyotaro@lab.ntt.co.jp> wrote: > > > Hello, I have a maybe-silly question. > > > > What makes us have both TRUE/true or FALSE/false as constants of > > bool? > > > > The following definitions in c.h didn't mess anything up. > > > > #define TRUE true > > #define FALSE false > > > > +1 > I don't know any policy about where to use TRUE and FALSE over true and > false. > > # NIL seems causing similar mess. > > > > NIL is used for lists, while NULL is used for other pointers. > That may cause redundant, but at least there is clear policy. Yes, I know and I like it personally, but NULL is sometimes used with list pointers. Looking on the face NIL === NULL is not proved but "if (!list)" is seen frequently. Compler doesn't distingush them and actually they harm nothing. This is all right but these facts make me doubt of the significance of NIL. Anyway, I don't mean that NIL ought to be removed immediately. It will be naturally resolved when we migrate to pure C++ world someday... ? regards, -- Kyotaro Horiguchi NTT Open Source Software Center
At Thu, 22 Jun 2017 09:13:56 -0400, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote in <08678a07-3967-8567-59e5-b9bcced7f457@2ndquadrant.com> > On 6/22/17 07:09, Kyotaro HORIGUCHI wrote: > > What makes us have both TRUE/true or FALSE/false as constants of > > bool? > > Historical reasons, probably. I plan to submit a patch to phase out or > remove TRUE/FALSE as part of a migration toward stdbool.h. So I suggest > you use lower case and don't worry about the other ones for now. Oh. I'm happy to hear that. Thanks for the information. regards, -- Kyotaro Horiguchi NTT Open Source Software Center