Don't use memset to initialise aggregate of floats.

In C3D_RENDER_OGL_LEGACY::setupMaterial(), the struct
m_materials (which is made up of floats and glm::vec3f's)
is initialised with a memset to 0. This is unsafe, as
floating point value representations in C++ are implementation-
defined (so 0 in memory is not 0-valued for sure).

Use empty-brace aggregate-initialisation, which does the right thing.
This commit is contained in:
John Beard 2018-11-09 11:58:38 +00:00 committed by Wayne Stambaugh
parent c5a2ea1dd8
commit e52688586a
1 changed files with 1 additions and 2 deletions

View File

@ -175,8 +175,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_arrows()
void C3D_RENDER_OGL_LEGACY::setupMaterials()
{
memset( &m_materials, 0, sizeof( m_materials ) );
m_materials = {};
if( m_settings.GetFlag( FL_USE_REALISTIC_MODE ) )
{