Compiler warnings on MSVC
When I pip installed pyscipopt 4.2.0 on Windows 11 with MSVC 2022 Build Tools, I got some compiler warnings.
The compile command (except I've replaced some long paths with environment variables just for legibility) that Pip issued:
set MSVC = %ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools\VC
set MSCVCTOOLS = %MSVC%\Tools\MSVC\14.34.31933
set WINKIT = %ProgramFiles(x86)%\Windows Kits\10\include\10.0.22000.0
%MSVCTOOLS%\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Program Files\SCIPOptSuite 8.0.3\include -IC:\Python310\include -I%MSVCTOOLS%\include -I%MSVC%\Auxiliary\VS\include -I%WINKIT%\ucrt -I%WINKIT%\\um -I%WINKIT%\\shared -I%WINKIT%\\winrt -I%WINKIT%\\cppwinrt /Tcsrc\pyscipopt\scip.c /Fobuild\temp.win-amd64-3.10\Release\src\pyscipopt\scip.obj
The warnings that MSVC issued:
src\pyscipopt\scip.c(100989): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\pyscipopt\scip.c(103872): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\pyscipopt\scip.c(104080): warning C4244: '=': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\pyscipopt\scip.c(107482): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\pyscipopt\scip.c(108068): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\pyscipopt\scip.c(108666): warning C4244: 'function': conversion from 'Py_ssize_t' to 'int', possible loss of data
src\pyscipopt\scip.c(123474): warning C4244: 'function': conversion from 'long' to 'char', possible loss of data
src\pyscipopt\scip.c(133561): warning C4244: 'function': conversion from '__int64' to 'int', possible loss of data
src\pyscipopt\scip.c(133625): warning C4244: 'function': conversion from '__int64' to 'int', possible loss of data
src\pyscipopt\scip.c(133689): warning C4244: 'function': conversion from '__int64' to 'int', possible loss of data
src\pyscipopt\scip.c(138636): warning C4244: 'function': conversion from 'long' to 'char', possible loss of data
src\pyscipopt\scip.c(139250): warning C4244: 'function': conversion from 'long' to 'char', possible loss of data
Probably they're all innocuous, but each of them is an implicit cast from a 64-bit signed integer to a 32-bit signed integer or from a 32-bit signed integer to an 8-bit signed integer, so the compiler isn't wrong that there's a possible loss of data. Most of these can probably be silenced with explicit casts in Cython. I'm not familiar with the Cython code base here, but I wonder if switching to Cython 3 might resolve any that can't be fixed with changing pyscipopt's Cython code?
Hey @wkschwartz! We just recently merged a PR that updates the repo to Cython 3, could you please check whether there's still a problem?