Embedded Engineer uses the types defined in stdint.h and stdbool.h (C99) to enable MISRA compatibility as well as platform independence.

Unfortunately, not every toolchain includes these datatypes, therefore it's sometimes neccessary to add the appropriate definitions. For bool, you can either include stdbool.h or you can add a Typedefs in your project which defines bool to be int. The code generator will use 1 for true respectively 0 for false, so you don't need to supply definitions for true or false.

Update for version 2.2 

Since MISRA 2004 Appendix E: Boolean expressions states that:

There is a conceptual difference between expressions which return a numeric value and expressions which return a Boolean value.


Boolean values are expected in the following contexts:

  • the controlling expression of an if statement
  • the controlling expression of an iteration statement
  • the first operand of the conditional operator

We changed the default use of 1 and 0 to return a "Boolean-by-construct" value:

  • equality operators (== and !=)
  • logical operators (!, && and ||)
  • relational operators (<, >, <= and >=)

Therefore the new true value in Embedded Engineer will be represented as !0 and the new false value will be !1.

  • No labels