This is the mail archive of the 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:

> what i'm referring to, is that i believe the following should all
> return true:
> 	__builtin_types_compatible_p(int, typeof(1))
> 	__builtin_types_compatible_p(int, typeof(1L))
> 	__builtin_types_compatible_p(int, typeof(1LL))
> 	__builtin_types_compatible_p(int, typeof(1U))
> 	__builtin_types_compatible_p(int, typeof(1ULL))
> 	__builtin_types_compatible_p(int, typeof(1UL))
> 	etc
> whereas now, these  return false.  they should return true-- after all,
> they are *compatible*.

They're not compatible.  Compatibility is defined in C99 subclause 6.2.7.  
They can be implicitly converted in a function call, by, but 
that's because one of the circumstances listed in (which are 
asymmetric - you can assign char * to const char * but not the other way 
round - whereas compatibility is symmetric) applies.

float, double and long double are all incompatible - and all need to be
distinguished for <tgmath.h> and such purposes for which
__builtin_types_compatible_p was designed - though they can be assigned to
each other.

Joseph S. Myers

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