Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c92b450

Browse files
committed
Suppress definitions of 'true' and 'false' macros if __cplusplus.
Since we're assuming a C++ compiler knows what 'bool' is, seems we should assume it knows 'true' and 'false' too. This prevents problems on some systems, per report from Leandro Fanzone.
1 parent 814f40c commit c92b450

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/include/c.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: c.h,v 1.100 2001/08/24 22:46:28 petere Exp $
15+
* $Id: c.h,v 1.101 2001/08/27 23:02:25 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -133,10 +133,13 @@
133133
* Section 2: bool, true, false, TRUE, FALSE, NULL
134134
* ----------------------------------------------------------------
135135
*/
136+
136137
/*
137138
* bool
138139
* Boolean value, either true or false.
139140
*
141+
* XXX for C++ compilers, we assume the compiler has a compatible
142+
* built-in definition of bool.
140143
*/
141144

142145
/* BeOS defines bool already, but the compiler chokes on the
@@ -145,11 +148,10 @@
145148
#ifndef __BEOS__
146149

147150
#ifndef __cplusplus
151+
148152
#ifndef bool
149153
typedef char bool;
150-
151-
#endif /* ndef bool */
152-
#endif /* not C++ */
154+
#endif
153155

154156
#ifndef true
155157
#define true ((bool) 1)
@@ -159,6 +161,8 @@ typedef char bool;
159161
#define false ((bool) 0)
160162
#endif
161163

164+
#endif /* not C++ */
165+
162166
#endif /* __BEOS__ */
163167

164168
typedef bool *BoolPtr;

0 commit comments

Comments
 (0)