Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ctype and gcc9

In article <20200921083148.GA17688@quantz>,
Patrick Welche  <> wrote:
>Since gcc9, essentially every ctype using piece of software fails with
>   error: array subscript has type 'char' [-Werror=char-subscripts]
>which prompts a style question: cast every argument of every call to
>a ctype function in every piece of software to (unsigned char), or
>-Wno-error=char-subscripts], or something else?

cast to unsigned char. The ctype functions have undefined behavior for
negative values other than -1. The code is buggy.


Home | Main Index | Thread Index | Old Index