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/27/2017 07:33 PM, Paul Eggert wrote:
On 11/27/2017 10:06 AM, Florian Weimer wrote:
I'm not certain about that at all—the *types* could well differ in signedness between architectures (as it is common for char).

char should not be a problem: on all glibc platforms, it's widened to int before comparison, so its signedness is not relevant to the comparison.

I don't understand.

It is perfectly reasonable to warn for

   ch == EOF

(with ch of type char) because that is always a bug, and for us (who strive to write portable code) even if char is signed.

It is not reasonable at all to warn for:

   ch == '\n'
   ch == 0
   ch == '\xff'

Surely the type should feed into the warning, but it can't be the sole arbitrator.

Florian


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