with strict C99 the tests/mpz/convert.c needs #include <strings.h>
vincent at vinc17.net
Mon Nov 9 07:53:52 UTC 2020
On 2020-11-09 06:29:47 +0100, Marco Bodrato wrote:
> That file will be changed in the next release. Please look if the applied
> patch fits your needs.
/* This is similar to POSIX strcasecmp except that we don't do the comparison
with unsigned char. We avoid strcasecmp for C standard conformance. */
str_casecmp (const char *s1, const char *s2)
for (i = 0;; i++)
int c1 = s1[i];
int c2 = s2[i];
if (c1 == 0 || tolower (c1) != tolower (c2))
return c1 - c2;
Is there a reason not to do the comparison with unsigned char?
In the context of the call, the values will always be nonnegative
so that this is OK, but there is a risk that some future developer
might reuse this function in another context, where it would be
incorrect on platforms with signed char (in particular, there is
no warning in the comment).
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
More information about the gmp-bugs