This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Does stdbool.h work for C *and* C++

We are doing mixed C / C++ development for 64xx.

A concern is the TI impl. of stdbool.h which defines bool to be _Bool for C, etc.

The problem is TI_CGT_C6000_7.4.1/include/stdbool.h for C is "typedef unsigned int _Bool"  -- which means sizeof(bool) is 4 whereas my  the same source compiled for C++ shows sizeof(bool) is 1.

This means that all my shared structs that I compile with both C and C++ need to be conditionalized for "bool" since stdbool.h bool for C is different than intrinsic c++ bool.

Why would having sizeof(bool) be different in C vs C++ be a good idea?  I don't think this is what C99 had in mind.

BTW the "unsigned int" impl works on 5510 just fine.  16 bit MAU.  :-)

dave

bool.c allocates 0x40 .far

#include <stdbool.h>
bool foo[16];

bool.cpp allocates 0x10 .far

#include <stdbool.h>
bool foo[16];