__BUILTIN_TYPES_COMPATIBLE_P(3) Library Functions Manual
__builtin_types_compatible_p -- GNU extension to check equivalent types
The __builtin_types_compatible_p() is a GNU extension for determining
whether two types are equivalent. If type_a is equivalent to type_b, a
value 1 is returned. Otherwise __builtin_types_compatible_p() returns 0.
The following remarks should be taken into account.
1. The architecture-specific size of the two types does not have
an impact on the result. For example, sizeof(char *) and
sizeof(int) result the same value on i386, but the types
naturally are not equivalent.
2. Type qualifiers are ignored. The function returns the same
value for long and const long.
3. The amount of pointer indirection affects the result. For
example, double * is not equivalent to double **.
4. Two types defined with typedef are equivalent if and only if
their underlying types are equivalent.
5. The enum type is a special case in that two enum types are not
The following example combines __builtin_types_compatible_p() and the
#define __COMPARE_TYPES(v, t) \
if (__COMPARE_TYPES(p, double) != 0)
err(EX_DATAERR, "invalid type");
gcc(1), __builtin_constant_p(3), typeof(3)
This is a non-standard, compiler-specific extension.
NetBSD 6.1.5 December 21, 2010 NetBSD 6.1.5