Subject: lib/25597: stdbool.h is unfriendly to C++
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <tshiozak@netbsd.org>
List: netbsd-bugs
Date: 05/16/2004 17:17:55
>Number:         25597
>Category:       lib
>Synopsis:       stdbool.h is unfriendly to C++
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun May 16 17:18:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Takuya SHIOZAKI
>Release:        1.6ZE
>Organization:
none
>Environment:
NetBSD aoi.bogus-hosts.imou.to 1.6ZE NetBSD 1.6ZE (AOI) #6: Fri Nov  7 23:43:13 JST 2003  tshiozak@aoi.bogus-hosts.imou.to:/home/current-build/src/sys/arch/i386/compile/AOI i386

>Description:
The following code cannot be compiled with c++ under NetBSD:

#include <stdbool.h>

bool foo;

Of course, ISO C++ specification does not mention to stdbool.h,
but it is preferable that this code can also be compiled with c++.
>How-To-Repeat:

>Fix:
The following patch is probably suitable:

--- /usr/include/stdbool.h      2003-10-06 01:07:17.000000000 +0900
+++ stdbool.h   2004-05-17 01:25:36.000000000 +0900
@@ -39,10 +39,12 @@
 #ifndef _STDBOOL_H_
 #define        _STDBOOL_H_
 
+#ifndef __cplusplus
 #define        bool    _Bool
 
 #define        true    1
 #define        false   0
+#endif
 
 #define        __bool_true_false_are_defined   1
 

>Release-Note:
>Audit-Trail:
>Unformatted: