1717: Initialize the last component of h_vec's to 1 in default ctor. .

https://svn.lrde.epita.fr/svn/oln/trunk/milena This error was triggered by the corresponding test (tests/core/h_vec). Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Initialize the last component of h_vec's to 1 in default ctor. . * mln/core/h_vec.hh (h_vec<d,C>::h_vec): Initialize the last component to the unit (1) to prevent unitialized vectors from triggering division-by-zero errors. h_vec.hh | 5 +++++ 1 file changed, 5 insertions(+) Index: mln/core/h_vec.hh --- mln/core/h_vec.hh (revision 1716) +++ mln/core/h_vec.hh (working copy) @@ -110,6 +110,11 @@ inline h_vec<d,C>::h_vec() { + /* Safety measure: set the last component to the unit (1). This + way, converting an unitialized h_vec to a vector won't trigger + division-by-zero errors if this last component were randomly + initialized to 0. */ + this->data_[d] = literal::one; } template <unsigned d, typename C>
participants (1)
-
Roland Levillain