Bjarni Ingi Gislason wrote:
> A question (comment) from the compiler (gcc 8.2):
>
> ../lib/vasnprintf.c:5107:35: warning: comparison of integer expressions of
> different signedness: 'int' and 'size_t' {aka 'long unsigned int'}
> [-Wsign-compare]
> if (count < maxlen
> ^
Thanks for reporting this. I'm fine with silencing such warnings
through casts, if the casts don't introduce bugs.
> The value of "count" is tested to be non-negative, so a cast to
> "size_t" is valid.
count is known to be >= 0, yes. But 'size_t' may be smaller than 'int',
and in this case the cast introduces a bug. Such platforms are rare
nowadays (Windows 3.1 was such a platform), but if we want the code
to make as little assumptions as possible, a better patch is needed.
Bruno