[tex-k] Wrong constant value?
karl at freefriends.org
Wed Dec 6 00:32:14 CET 2017
#define SCHAR_MAX 127
Indeed. Fixed, thanks.
It has never mattered in kpathsea, I suppose, because no other kpathsea
source files appear to use the constant that I can tell.
grep reports that SCHAR_MAX (and SCHAR_MIN) is used in web2c-parser.y
(and nowhere else in TL's source tree). I suspect there are a
combination of reasons why the error has never mattered. One being that
on (I suppose) all modern systems, <limits.h> defines the values so the
kpse values are never used. They are only there as a fallback.
TeX's code avoids treating the most negative twos-complement value for
an integer as legal, so that any integer value can be negated safely.
Judging by my comments in c-minmax.h, I guess I was looking at some
standard for ANSI C (ca.1992) which specified the lowest/highest
acceptable values. I doubt I had the brains or memory to compare with
TeX. But I suppose ANSI C eschewed the most-negative number for the same
reason as TeX, since as far as I can recall it wasn't supposed to
require twos-complement machines ... --thanks, karl.
More information about the tex-k