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 4545 also seen for \code {nullptr } (C23 and C ++ 11 ). Masking these by
4646 macros \emph {may } generate correct code (but not always ) and always
4747 results in confusing - to - read code.
48+ %% Someone defined ' true' as - 1 , for example.
4849 }
4950 }
5051
504505 declaration for \c ode{F77_SUB(interv)}. This is intended to be
505506 called from Fortran and was wrongly declared: \c ode{LOGICAL} in
506507 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.
507519 }
508520 }
509521
Original file line number Diff line number Diff line change 2525
2626#ifndef R_EXT_BOOLEAN_H_
2727#define R_EXT_BOOLEAN_H_
28+ #if !defined(R_INCLUDE_BOOLEAN_H ) || R_INCLUDE_BOOLEAN_H
2829
2930// NB: there is a version of this in Rmath.h0[.in]
3031
@@ -73,4 +74,12 @@ extern "C" {
7374}
7475#endif
7576
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 */
7685#endif /* R_EXT_BOOLEAN_H_ */
You can’t perform that action at this time.
0 commit comments