Reputation: 13297
Here's the assert. In what reasonable circumstances can it fail, and why is the game checking it?
Upvotes: 1
Views: 326
Reputation: 11
I think I have come across the the answer you were looking for. Doom 3 is cross platform and on x86 platforms bool is defined by gcc with a size of 1. In gcc(compiler used by Apple at the time),on Mac OS X PowerPC on the other hand it defaults to 4. Use the -mone-byte-bool to change it to 1.
From http://linux.die.net/man/1/g++
-mone-byte-bool Override the defaults for "bool" so that "sizeof(bool)==1". By default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1 when compiling for Darwin/x86, so this option has no effect on x86. Warning: The -mone-byte-bool switch causes GCC to generate code that is not binary compatible with code generated without that switch. Using this switch may require recompiling all other modules in a program, including system libraries. Use this switch to conform to a non-default data model.
Upvotes: 1
Reputation: 137810
Some platforms define bool
to be the same size as int
. At least older versions of Mac OS X (and likely other RISC BSD ports) were like this. Presumably the code uses bool
arrays with an assumption of efficiency. Doom has been ported to a lot of platforms so it's probably very cagey about such things.
It has to be done at runtime because there is no standard macro specifying sizeof(bool)
, and compile time checks didn't work with non-macro expressions until C++11.
Upvotes: 5