Hi all, For example, here is isspace implementation: # define isspace(c) \ ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\r' || \ (c) == '\f' || (c) == '\v') The argument of c will evaluate 6 times, which make the following code suddenly fail: while (end != begin) { If (!isspace(*--end)) { break; } } But it work well with other libc implementation, because all other libc utilize a table to classify the char type: https://github.com/bminor/newlib/blob/master/newlib/libc/include/ctype.h#L97 https://github.com/bminor/glibc/blob/master/ctype/ctype.h#L197 and the argument only need evaluate once. So my question is: can we implement ctype functions through table to improve the compatibility? Yes, the table need take more 256 bytes ROM space, but the complex expression used in NuttX also bloat the code size, especially considering ctype function is used very frequently.
Thanks Xiang