[PATCH] support: Add TEST_COMPARE macro

Florian Weimer fweimer@redhat.com
Fri Nov 24 09:28:00 GMT 2017


On 11/24/2017 09:46 AM, Paul Eggert wrote:
> It'd be cleaner and simpler to test for negative than positive integers. 
> "bool negative = n < 0;" extracts N's sign bit if N is signed and 
> requires no machine instructions if N is unsigned; "bool positive = n > 
> 0;" is trickier.

I expect that GCC will eventually warn about such tautological 
comparisons.  The current approach avoids such warnings.

> I don't know what the context for this new macro is, and like Andreas 
> I'm a bit puzzled as to its intended use.

The purpose is to check if two values are the same, and print them (and 
record a test failure) if they are not.

Thanks,
Florian



More information about the Libc-alpha mailing list