[PATCH] support: Add TEST_COMPARE macro

Paul Eggert eggert@cs.ucla.edu
Mon Nov 27 18:53:00 GMT 2017


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.



More information about the Libc-alpha mailing list