tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: ctype(3), again
On Mon, Jan 14, 2019 at 03:44:32PM +0100, Thomas Klausner wrote:
> The standard workaround is to cast arguments to (unsigned char). I've
> provided patches for gnucash for that, but they received pushback
> because the compiler shouldn't error out on this undefined behaviour.
> (gnucash upstream is happy with it dumping core at runtime)
>
> Here's the bug report with more details.
>
> https://bugs.gnucash.org/show_bug.cgi?id=797039
Our code is explicitly *trying* to enforce this warning, see the CAVEATS
section in ctype(3).
Checking this at runtime would be stupid and time consuming, also a library
doing calls that then crash the application is most stupid.
If you already knnow the value is not EOF, casting it to (unsigned char)
and then (ex- or implicitly) to (int) never does any harm.
Martin
Home |
Main Index |
Thread Index |
Old Index