...
On implementations where plain char is signed, this code example is noncompliant because the parameter to isspace()
, *t
, is defined as a const char *
, and this value may not be representable as an unsigned char
.:
Code Block | ||||
---|---|---|---|---|
| ||||
#include <ctype.h> #include <string.h> size_t count_preceding_whitespace(const char *s) { const char *t = s; size_t length = strlen(s) + 1; while (isspace(*t) && (t - s < length)) { ++t; } return t - s; } |
...