File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 45
45
also seen for \code {nullptr } (C23 and C ++ 11 ). Masking these by
46
46
macros \emph {may } generate correct code (but not always ) and always
47
47
results in confusing - to - read code.
48
+ %% Someone defined ' true' as - 1 , for example.
48
49
}
49
50
}
50
51
504
505
declaration for \c ode{F77_SUB(interv)}. This is intended to be
505
506
called from Fortran and was wrongly declared: \c ode{LOGICAL} in
506
507
Fortran corresponds to \c ode{int *} not \c ode{Rboolean *}.
508
+
509
+ \i tem Defining \c ode{R_INCLUDE_BOOLEAN_H} to \c ode{0} before
510
+ including headers \f ile{R.h} or \f ile{Rinternals.h} (or any other
511
+ header which includes \f ile{R_ext/Boolean.h}) stops the inclusion
512
+ of header \c ode{R_ext/Boolean.h} which `defines' constants
513
+ \code {TRUE }, \code {true }, \code {false } and the type \code {bool }
514
+ which some package maintainers wish to avoid.
515
+
516
+ Note that the last three are keywords in C23 and C ++ 11 so cannot be
517
+ avoided entirely. However , with commonly - used compilers they can be
518
+ masked by a macro of the same name , often with a warning.
507
519
}
508
520
}
509
521
Original file line number Diff line number Diff line change 25
25
26
26
#ifndef R_EXT_BOOLEAN_H_
27
27
#define R_EXT_BOOLEAN_H_
28
+ #if !defined(R_INCLUDE_BOOLEAN_H ) || R_INCLUDE_BOOLEAN_H
28
29
29
30
// NB: there is a version of this in Rmath.h0[.in]
30
31
@@ -73,4 +74,12 @@ extern "C" {
73
74
}
74
75
#endif
75
76
77
+ #else
78
+ /* The Rbolean type is used in too many R headers to condition them
79
+ * all. However, people defining R_INCLUDE_BOOLEAN_H=0 should not be
80
+ * using it in their own code, and its base type is expected to be int
81
+ * (and guaranteed to be on most platforms as from R 4.5.0). */
82
+
83
+ typedef Rboolean int ;
84
+ #endif /* R_INCLUDE_BOOLEAN_H = 0 */
76
85
#endif /* R_EXT_BOOLEAN_H_ */
You can’t perform that action at this time.
0 commit comments