Last active
August 29, 2015 14:06
-
-
Save zed/ba2de81701a187cbbd83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // show that c99 isspace returns the same result for char and unsigned char | |
| #include <algorithm> | |
| #include <cctype> | |
| #include <climits> | |
| #include <iostream> | |
| int main() { | |
| for (char c = CHAR_MIN; ; ++c) { // iterate over all char values | |
| unsigned char u = c; | |
| if (::isspace(c) != ::isspace(u)) { // error | |
| std::cerr << static_cast<int>(c) << std::endl; | |
| return 1; | |
| } | |
| if (c == CHAR_MAX) | |
| break; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment