Skip to content

Commit 7c7133b

Browse files
committed
#include <stdbool.h>
17+ years passed since standardized in ISO, 8 years since we added AC_HEADER_STDBOOL to configure.in. I'm quite confident that it's already safe to use <stdbool.h>. I understand that when we introduced AC_HEADER_STDBOOL, <stdbool.h> was remain not included because C standard and SVR4 curses conflicted miserably back then (#1). Though I believe such situation has been fixed already(#2), I'm afraid of your operating system might ship a proprietary curses that still conflicts with the standard. So to avoid potential problem, we limit the inclusion to our internal use only. #1 : 1997 version of SUSv2 said bool is "defined though typedef" in <curses.h>, while C99 said bool is a macro, plus in C++ bool is a keyword. AFASIK the curses library has never been a part of POSIX. #2 : In reality ncurses and NetBSD curses both just follow C99 to include <stdbool.h> from <curses.h>. I think C99 is now widely adopted. ---- * internal.h: #include <stdbool.h> if present. That is believed to be the case for 99.9% systems that lives today. Non-C99, non-C++ situations are intentionally left undefined, advised by Motohiro Kosaki. If you have such compiler, please fill the definition appropriately. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent d617fce commit 7c7133b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

internal.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ extern "C" {
2323
#endif
2424
#endif
2525

26+
#ifdef HAVE_STDBOOL_H
27+
# include <stdbool.h>
28+
#endif
29+
30+
#ifndef __bool_true_false_are_defined
31+
# ifndef __cplusplus
32+
# error :FIXME: You are the first one who use pre-C99 compiler.
33+
# error :FIXME: Please add appropriate definition here.
34+
# error :FIXME: This part is intentionally left undefined,
35+
# error :FIXME: because the author no longer have such environment.
36+
# endif
37+
#endif
38+
2639
#define LIKELY(x) RB_LIKELY(x)
2740
#define UNLIKELY(x) RB_UNLIKELY(x)
2841

0 commit comments

Comments
 (0)