[PATCH] support: Add TEST_COMPARE macro
Florian Weimer
fweimer@redhat.com
Fri Dec 1 15:53:00 GMT 2017
On 11/27/2017 07:53 PM, Paul Eggert wrote:
> On 11/27/2017 10:43 AM, Florian Weimer wrote:
>> I don't understand.
>>
>> It is perfectly reasonable to warn for
>>
>> Â Â ch == EOF
>>
>> (with ch of type char)
>
> Sure, but that's a different topic. I was writing about the topic at
> hand, which is that C integer comparison sometimes disagrees with
> mathematical comparison. When ch is of type char, (ch == EOF) always
> returns the mathematically-correct answer on glibc platforms. None of
> the proposed TEST_COMPARE patches would catch the char-vs-EOF problem,
> because they're not designed to catch it: they're designed to catch the
> C-vs-mathematical comparison problem.
Yeah, we got side-tracked.
I incorporated your suggestion about rejecting sign-altering promotions
into the attached patch. It also prints hexadecimal values with the
appropriate (type-dependent) width.
Thanks,
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_compare.patch
Type: text/x-patch
Size: 10050 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20171201/4c068c0b/attachment.bin>
More information about the Libc-alpha
mailing list