What is the purpose / advantage / difference of use
/* C89 compliant way to cast 'char' to 'unsigned char'. */ static inline unsigned char to_uchar (char ch) { return ch; }
compared to standard litas?
Edit: Found in base64 code in gnulib
Maybe the programmer who wrote this function doesn't like the translation syntax ...
foo(to_uchar(ch)); /* function call */ foo((unsigned char)ch); /* cast */
But I would still think of a compiler :)
void foo(unsigned char); char s[] = "bar"; foo(s[2]); /* compiler implicitly casts the `s[2]` char to unsigned char */
To:
char
unsigned char
It could be:
numeric_limits<>