When built without AM_CXXFLAGS += -Wno-memset-elt-size on the AutoMake Makefile, i get this error:
error: ‘memset’ used with length equal to number of elements without multiplication by element size [-Werror=memset-elt-size] memset (_floatOptions, 0, sizeof(_floatOptions));
This is the line that triggers it:
memset (_floatOptions, 0, sizeof(_floatOptions));
And this is the relevant code:
class random_class
{
public:
enum FloatOption
{
numFloatOptions
};
/// Set a float option value
/// @param f Float Option
/// @param value value to be set
void setFloatValue(FloatOption f, double value)
{
_floatOptions[f] = value;
_isSetFloat[f] = true;
}
/// Return value of an float option
/// @param f Float Option
/// @return HostPlacement
double getFloatValue(FloatOption f) const
{
return _floatOptions[f];
}
private:
double _floatOptions[numFloatOptions];
Does anyone know why this happens and how I can mitigate it?
I couldn't find much info on this warning/error online.