Closed jcoder58 closed 1 year ago
C4800 Implicit conversion from 'const size_t' to bool. Possible information loss ureact\detail\take_drop_base.hpp 52
// checkable in boolean context
explicit operator bool() const
{
return m_value;
}
It is valid C++ code. Try to change it with either of the following variants:
return bool(m_value);
return static_cast<bool>(m_value);
return m_value != 0;
return !!m_value;
I need to know which of them don't trigger the error.
C4459 declaration of 'elements' hides global declaration
ureact\detail\slot_map.hpp 261
void shake( const size_type elements )
{
const auto total_size = [&]() { return elements + m_size; };
while( m_size > 0 && back_() == total_size() - 1 )
{
--m_size;
}
}
It seems that is is consequence of using namespace ureact
and including <ureact/adaptor/elements.hpp>
. Normally they are in different namespaces, so there is no any trace of shadowing. But once elements
included in the global scope, it's become a reason for warning.
Try to rename elements
arg to elements_amount
or something. It was not so correct name in the first place.
I need to check my MSVC warnings list. Ureact is tested with github actions with lots of enabled warnings. Which warnings flags do you use? I use /W3
. I heard that /W4
is kinda broken. It is full of false positives like you listed above. That's why /W3
is IDE default level, at least it is useful.
I've made the changes you suggest and everything compiles.
I used return m_value != 0;
I'm compile it as part of Unreal Engine, so I assume it uses /W4.