[Insight-developers] FixedArray() default cstor

Mathieu Malaterre mathieu.malaterre at gmail.com
Wed Aug 22 08:05:54 EDT 2007


Hello,

 Reading the code of FixedArray I find:

/**
 * Default constructor uses compiler's default initialization of memory.
 * For efficiency, no initialization to zero is done.
 */
template <typename TValueType, unsigned int VLength>
FixedArray<TValueType, VLength>
::FixedArray()
{
}

Well it seems to me that this is a very easy way to shoot yourself in
the foot, since the GetMacro call the operator== before attempting to
set a value, which means that every single value contained in the
array will be checked. So the default cstor will be inconsistant with
the implementation of FixedArray::operator==

Because early optimization are evil, does anyone knows of any tests
that heavily rely on setting FixedArray to garbage values ?

Thanks


-- 
Mathieu


More information about the Insight-developers mailing list