This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: new __builtin_choose_type (patch) (new builtin_equal_types patch)
Aldy Hernandez wrote:
>
> On Wed, 2001-10-03 at 04:15, Magnus Fromreide wrote:
> > It is my feeling that it would be more general and cleaner to do something
> > along the lines of
> >
> > _Bool __builtin_equal_types(arg|type, arg|type)
> >
> > that doesn't evaluate the arguments if they are expressions and answers
> > the question of wether they are of the same type.
> >
> > Usage examples:
> >
> > __builtin_equal_types(x, y) ? no() : x = 10;
> > if(__builtin_equal_types(x, y))
> > {
> > }
> > else
> > {
> > }
>
> thought about it. like it. nice and clean.
>
> is everyone ok with this approach? it's pretty. it's got
> documentation. it's got a test case. :)
Doesn't your patch still have the char->int promotion problem?
What does _builtin_equal_types(ch, i) return for variables that
are char and int, respectively?
Also, in honor of GCC's Lispy origins, it should be called
__builtin_equal_types_p . (Just kidding!)
Stan