I'd just make the cast explicit: inline constexpr vsize VPOS (vsize(-1));
It's cleaner and requires less updates as the code evolves. However, I can't reproduce it, what compiler flags are you using? I'm using -Wall and clang is quiet about this use case */tmp %* g++ -Wall -std=c++17 xxx.cc */tmp %* cat xxx.cc #include <iostream> inline constexpr size_t x(-1); int main() { std::cout << x << std::endl; } */tmp %* g++ --version Apple clang version 15.0.0 (clang-1500.1.0.2.5) Target: x86_64-apple-darwin23.3.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin */tmp %* ./a.out 18446744073709551615 */tmp %* L On Tue, 27 Feb 2024, 12:57 Aaron Hill, <lilyp...@hillvisions.com> wrote: > On 2024-02-27 3:32 am, Werner LEMBERG wrote: > > Looking at some MacPorts log files from Mac OS 14.2.1 (which uses the > > system's `clang` compiler) I see > > > > ``` > > flower/include/flower-proto.hh:26:30: > > warning: implicit conversion changes signedness: > > 'int' to 'const vsize' (aka 'const unsigned long') > > [-Wsign-conversion] > > inline constexpr vsize VPOS (-1); > > ~~~~ ^~ > > ``` > > > > for almost all C++ fies, making the log file quite noisy. Dan, any > > idea how to fix this gracefully? > > Since vsize is just a typedef of size_t, would it make sense to use > SIZE_MAX when defined VPOS instead of a manual cast of negative one? > > > -- Aaron Hill > >