bool different in C and C++?

Lubomir I. Ivanov neolit123 at gmail.com
Sat Nov 18 09:33:33 PST 2017


On 18 November 2017 at 19:26, Berthold Stoeger
<bstoeger at mail.tuwien.ac.at> wrote:
> On Samstag, 18. November 2017 17:34:59 CET Lubomir I. Ivanov wrote:
>> On 18 November 2017 at 18:19, Berthold Stoeger
>> > On the other hand, many of the boolean settings are indeed defined as
>> > short. Shouldn't this be made consistent?
>>
>> both sizeof(short) and sizeof(bool) are implementation defined.
>> i think this can be changed, yes...and let's see if we break
>> something; bool should be mostly 1 byte everywhere.
>
> Sure, but can these definitions be different for C and C++ on any sane
> platform? The current code seems to assume that they are the same, otherwise
> pref.h would break in horrible ways, wouldn't it?
>
> By the way, I wasn't suggesting bool over short, just that it should be either
> one or the other. Not a completely random mix as it is now. So I take you
> would vote for bool?
>

yes, i understood the suggestion and i've implied that we should try
to be consistent - use bool:

> i think this can be changed, yes...and let's see if we break something;
> bool should be mostly 1 byte everywhere.

so my point was that we can attempt to rely on the fact that the C and
C++ bool is *probably* 1 byte.

lubomir
--


More information about the subsurface mailing list