Issues interfacing between C++ and Fortran

I found a short explanation of the inconsistency in a source code comment:

//   In C++ bool is a keyword while in C99 bool is a macro defined
//   in stdbool.h. It is possible for the two to be inconsistent.
//   For example, neither the C99 nor the C++11 standard force a byte
//   size on the bool type, so the macro defined in stdbool.h could
//   be inconsistent with the bool keyword in C++. Thus, the use
//   of stdbool.h is avoided and unsigned char is used instead.

It might be best to avoid the C bool in mixed-language programming.

2 Likes