[libc-commits] [PATCH] D106902: [libc][NFC] Add explicit casts to ctype functions

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Aug 17 16:36:07 PDT 2021

sivachandra added a comment.

The `isprint` test is still failing. I have left a comment inline explaining why.

BTW, if you need help with building/testing your patches, let me know and I can give you few instructions. Or, you can lookup the command from the builder logs, from here for example: https://lab.llvm.org/buildbot/#/builders/78/builds/16544

Comment at: libc/src/ctype/isprint.cpp:19
+  const unsigned char ch = static_cast<unsigned char>(c);
+  return static_cast<int>((ch - ' ') < 95);
I think this is still incorrect. For `ch - ' '`, the operands get promoted to the `int` type making the predicate evaluate to `true` for `c` less than `' '`.



More information about the libc-commits mailing list