This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: [PATCH] support: Add TEST_COMPARE macro


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


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