Mercurial > hg > octave-nkf
changeset 10830:b4ebfd675321
avoid static initialization disaster in dim_vector
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 29 Jul 2010 08:47:26 +0200 |
parents | 61cb53ae9db3 |
children | 1646bd8e3735 |
files | liboctave/ChangeLog liboctave/dim-vector.cc liboctave/dim-vector.h src/bitfcns.cc |
diffstat | 4 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2010-07-29 Jaroslav Hajek <highegg@gmail.com> + + * dim-vector.cc (dim_vector::dim_max (void)): Turn it into a function. + (dim_vector::safe_numel): Update usage. + * dim-vector.h: Update declaration. + 2010-07-27 Jaroslav Hajek <highegg@gmail.com> * dbleSCHUR.cc (SCHUR::SCHUR (const Matrix&, const Matrix&)):
--- a/liboctave/dim-vector.cc +++ b/liboctave/dim-vector.cc @@ -33,8 +33,11 @@ // off the maximum value of octave_idx_type. // Currently 1 is subtracted to allow safe conversion of any 2D Array into Sparse, // but this offset may change in the future. -const octave_idx_type -dim_vector::dim_max = std::numeric_limits<octave_idx_type>::max () - 1; +octave_idx_type +dim_vector::dim_max (void) +{ + return std::numeric_limits<octave_idx_type>::max () - 1; +} void dim_vector::chop_all_singletons (void) @@ -89,7 +92,7 @@ octave_idx_type dim_vector::safe_numel (void) const { - octave_idx_type idx_max = dim_max; + octave_idx_type idx_max = dim_max (); octave_idx_type n = 1; int n_dims = length ();