Gurus,

As seen by my previous post, I am interfacing C to C++. In this endeavor a question arose as to the C equivalent of bool.

How can one define bool to be used in structures which are shared between C++ and C files? How can one guarantee that the structures have the same size in the two languages?

Maybe there is no safe solution.

Thanks.

Sincerely, Chris.



Code:
// In some header
typedef int INT32;

#if !defined(__cplusplus)
  typedef enum { false = 0, true  = 1 } bool;
#endif

// Is this structure guaranteed to have the same
// size in C++ as well as C?
typedef struct
{
  INT32 n;
  bool  b;
}
t_data;