[cfe-dev] How to use _Bool
devlists at shadowlab.org
Fri Apr 20 14:07:56 PDT 2012
Le 20 avr. 2012 à 20:48, Eli Friedman a écrit :
> On Fri, Apr 20, 2012 at 3:32 AM, Jochen Wilhelmy
> <jochen.wilhelmy at googlemail.com> wrote:
>> when using _Bool I get the following error:
>> error: unknown type name '_Bool'
>> I use clang 3.0 as a library. my langOptions are the following:
>> langOptions.Bool = 1;
>> langOptions.CPlusPlus = 1;
>> langOptions.RTTI = 0;
>> langOptions.AltiVec = 1;
>> langOptions.Freestanding = 1; // no magic for main
>> It was recommendet to me to use _Bool instead of bool so that clang uses
>> i1 instead
>> of i8 for boolean variables when generating code.
>> What do I have to do that clang knows about _Bool?
> "_Bool" is a C-only thing; use "bool" in C++.
Note that in C99, bool should expand to _Bool (if you include a C compliant stdbool.h header), so it should not make any difference if you use one or the other.
More information about the cfe-dev