[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Stack module and -Wsign-compare
From: |
Bruno Haible |
Subject: |
Re: Stack module and -Wsign-compare |
Date: |
Wed, 05 Jan 2022 19:00:13 +0100 |
Marc Nieper-Wißkirchen:
> If "stack.h" is included by client code that is supposed to be
> compiled with "-Wsign-compare", the compiler will complain about the
> comparison on line 121.
Indeed: although we don't care about -Wsign-compare warnings in Gnulib
code, consumers of .h files from Gnulib may well do.
> The simplest fix is to replace the comparison by:
>
> stack->size == (size_t) stack->allocated
Another possible fix would be to change
size_t size;
to
idx_t size;
in the struct.
Bruno