# Issues interfacing between C++ and Fortran

**URL:** <https://fortran-lang.discourse.group/t/issues-interfacing-between-c-and-fortran/456>\
**Category:** Uncategorized\
**Created:** [December 1, 2020, 4:04pm UTC](https://fortran-lang.discourse.group/t/issues-interfacing-between-c-and-fortran/456 "2020-12-01T16:04:34Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [April 11, 2021, 9:27pm UTC](https://fortran-lang.discourse.group/t/issues-interfacing-between-c-and-fortran/456/15 "2021-04-11T21:27:22Z")

</div>

> [@sblionel](#):
>
> I am quite taken aback at the notion that C and C++ would have different interpretations of `bool` .

I found a short explanation of the inconsistency in a [source code comment](https://github.com/tensorflow/tensorflow/blob/8855f56500ff8efa449662a95fe69f24bb78c0a6/tensorflow/c/c_api.h#L44):

```auto
// 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.

---

_[View the full topic](https://fortran-lang.discourse.group/t/issues-interfacing-between-c-and-fortran/456)._
