Size of D bool vs size of C++ bool

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 4 13:38:16 PDT 2017


On 8/4/17 4:16 PM, Jeremy DeHaan wrote:
> I'm trying to do some binding code, and I know that C++ bool isn't 
> defined to be a specific size like D's bool. That said, can I assume 
> that the two are the same size on the most platforms?

I shudder to think that D may work with a platform that doesn't consider 
it to be 1 byte :)

> The only platforms I'm really interested in are Windows, Linux, OSX, 
> iOS, FreeBSD, Android. The only thing that might throw me off is if 
> there are some things that Linux or FreeBSD target where this is not the 
> case, but these machines are probably out of the scope of my project.

I would say any platform that D currently supports, C++ bool is defined 
to be 1 byte.

The ldc/gdc guys would know better.

-Steve


More information about the Digitalmars-d-learn mailing list