Re: [hatari-devel] Warnings

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


On 03/10/2020 at 09:55, Thomas Huth wrote:
Oh, Cygwin still has such a crappy implementation of the ctype functions?
How old is your Cygwin installation? Maybe they fixed it in newer
versions?

My Cygwin installation is up-to-date (32-bit variant). Compiler is GCC 10.2.0.

By the way, the official ctype API is messy. Functions take an int as parameter instead of char, to also allow EOF as parameter, with a value different from all possible char. So if the parameter is a raw char AND compiler uses signed char by default AND the value is negative (i.e. accented characters), we lose.

As I understand, the correct way to call ctype functions is something like:

extern char c;
if (isprint((unsigned int)c)) ...

Assuming that the compiler will not issue a warning because of passing an unsigned int argument to an int parameter, otherwise we need an extra cast to int. Situation may even be different if ctype functions are actually defined as macros.

BTW, I don't really mind about those warnings. I just wanted you to be aware of them, to avoid potential issues.

--
Vincent Rivière



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/