This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Why are bools cast to int in conditionals?
"Joseph S. Myers" <jsm@polyomino.org.uk> writes:
> On Wed, 21 Apr 2004, Dan Nicolaescu wrote:
>
> > In more "complex" cases the casts are not be eliminated by the tree
> > optimizers:
> >
> > _Bool foo (_Bool a, _Bool b)
> > {
> > if (a != b)
>
> Here, the usual arithmetic conversions are applied to the operands of !=,
> which includes the integer promotions, which promote _Bool to int.
Is _Bool different from other types in this respect? short, chars and
enums don't seem to get the same treatment.
Are there any operators that don't require the promotion of _Bool to
int?