C++ and D bool compatibility
bearophile
bearophileHUGS at lycos.com
Sat Apr 27 16:38:16 PDT 2013
Jeremy DeHaan:
> I was reading this:
> http://dlang.org/cpp_interface.html
>
> And it mentions the various types and their compatibility with
> one another, but it leaves out bools. It would be very useful
> for me if it works out like this, but does anyone know off the
> top of their heads/tried it before?
If it misses bool, then maybe that page needs a documentation
patch.
bools in D are represented with 1 byte, 0 or 1.
In C++ their size is not fixed: "for Visual C++ 4.2, a call of
sizeof(bool) yields 4, while in Visual C++ 5.0 and later, the
same call yields 1."
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list