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]
Other format: [Raw text]

Re: rfc: __builtin_types_compatible_p and unsigned literals


On Mon, 6 May 2002, Aldy Hernandez wrote:

> for example,
> 
> 	int foo (unsigned int blah) { }
> 
> accepts foo(31) as well as foo(31U).

It also accepts foo(31LL) and other such implicitly convertible types, if
the prototype is in scope.  Or are you referring to the special case where
a prototype isn't in scope (and for variable arguments), and
signed/unsigned can be mixed provided the value is representable in both
types?

> can i "fix" __builtin_types_compatible_p?

The types aren't compatible.  (Pointers to them aren't even implictly
convertible, though you'll need -pedantic to get a warning about that.)  
Making the specification more complicated and less representative of the
name of the built-in function seems dubious.

-- 
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]