cppcoreguidelines-pro-type-union-access
According to https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md using union for type-punning is undefined behaviour. Replace it with std::memcpy
This commit is contained in:
@@ -202,8 +202,7 @@ Py::Object WaypointPy::getPos(void) const
|
||||
|
||||
void WaypointPy::setPos(Py::Object arg)
|
||||
{
|
||||
union PyType_Object pyType = {&(Base::PlacementPy::Type)};
|
||||
Py::Type PlacementType(pyType.o);
|
||||
Py::Type PlacementType(Base::getTypeAsObject(&(Base::PlacementPy::Type)));
|
||||
if(arg.isType(PlacementType))
|
||||
getWaypointPtr()->EndPos = *static_cast<Base::PlacementPy*>((*arg))->getPlacementPtr();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user