Warning C4310
chacha21 opened this issue · 3 comments
If you want to cleanup some more warnings, there is this one with MSVC 2019 :
muparser-master\include\muParserBase.h(182,74): warning C4310: cast truncates constant value
for the line
void Error(EErrorCodes a_iErrc, int a_iPos = (int)mu::string_type::npos, const string_type& a_strTok = string_type()) const;
It is revealed at /W4 and fixed by a static_cast<int>
I wish i could...
This would require me to change the signature of the function, this in turn will break the ABI which is potentially more dangerous than the truncation. The truncation itself does not really matter inside muparser.
I do not suggest to replace int a_iPos
, but rather (int)mu::string::npos
by static_cast<int>(mu::string::npos).
This would be exactly the same code, with the same truncation, without a signature change. It just gets rid of the warning.
(Actually I know the warning is harmless, the only inconvenience for me is polluting my build logs with minor noise)
Ok, seems reasonable.