This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: new __builtin_choose_type (patch)


On 2 Oct 2001, Aldy Hernandez wrote:

> it was suggested to have a builtin analogous to the ?: operator that
> will work as follows:
> 
> 	__builtin_choose_type (exp0, type, exp1, exp2);
> 
> if <exp0> is of type <type>, evaluate <exp1> else evaluate <exp2>.
> 
> i have a patch for this feature and i'd like some comments.

Since your patch doesn't add documentation or testcases, I don't know what
it really intends.  In a case like this, the documentation and the
testcases are more useful for people to comment on than the code patch,
and can usefully be written first.

What is the return type of the builtin?  What is the return value?  Do the
default argument promotions get applied to the arguments of it?  (Anything
that applies the default argument promotions is unsuitable for <tgmath.h>,
where float must be handled differently from double; whereas types such as
char which are subject to the integer promotions don't matter here.)

-- 
Joseph S. Myers
jsm28@cam.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]