[tree-ssa] Why are bools cast to int in conditionals?
Dan Nicolaescu
dann@godzilla.ics.uci.edu
Thu Apr 22 03:15:00 GMT 2004
"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?
More information about the Gcc
mailing list