Eric Blake wrote:
> Rather than use lots of casts, coreutils does this in a common header:
> 
> /* Convert a possibly-signed character to an unsigned character.  This is
>    a bit safer than casting to unsigned char, since it catches some type
>    errors that the cast doesn't.  */
> static inline unsigned char to_uchar (char ch) { return ch; }

This figures better type safety (yields a warning when one passes a pointer
instead of an integer type), at the expense of debugging (you know how
confusing gdb behaves when you step through inline functions) and of speed
(when using compilers which don't support 'inline').

Bruno



Reply via email to