This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

stdbool.h should be compatible with C++


The following program:

----------------------------
#include <stdbool.h>
bool foo;
----------------------------

could, with a little care, compile under C and C++.  It fails under
gcc-2.95.2 c++.

Of course, portable programs cannot do this - they must autoconfiscate
themselves.

FYI, I am placing the following obvious autoconfiscated program
fragment into the Public Domain:

#ifndef __cplusplus
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
#else /* Implement <stdbool.h> ourselves */
#undef	bool
#undef	true
#undef	false
#undef	__bool_true_false_are_defined

#define	bool emacs_bool
#define	true  1
#define	false 0
#define	__bool_true_false_are_defined 1
typedef unsigned int emacs_bool;
#endif /* ! HAVE_STDBOOL_H */
#endif /* ! C++ */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]