In C++98 array size shall be an integral constant expression. Fixes
authorladanyi
Sat, 01 Mar 2008 20:09:40 +0000
changeset 25913b4d5bc3b4fb
parent 2590 47c245b97199
child 2592 f1fb0c31f952
In C++98 array size shall be an integral constant expression. Fixes
ticket 12.
lemon/lp_cplex.cc
lemon/lp_glpk.cc
     1.1 --- a/lemon/lp_cplex.cc	Sat Mar 01 20:07:29 2008 +0000
     1.2 +++ b/lemon/lp_cplex.cc	Sat Mar 01 20:09:40 2008 +0000
     1.3 @@ -91,11 +91,11 @@
     1.4      CPXgetcolname(env, lp, 0, 0, 0, &storespace, col, col);
     1.5  
     1.6      storespace *= -1;
     1.7 -    char buf[storespace];
     1.8 +    std::vector<char> buf(storespace);
     1.9      char *names[1];
    1.10      int dontcare;
    1.11      ///\bug return code unchecked for error
    1.12 -    CPXgetcolname(env, lp, names, buf, storespace, &dontcare, col, col);
    1.13 +    CPXgetcolname(env, lp, names, &*buf.begin(), storespace, &dontcare, col, col);
    1.14      name = names[0];
    1.15    }
    1.16    
    1.17 @@ -402,8 +402,8 @@
    1.18    }
    1.19    bool LpCplex::_isBasicCol(int i) const
    1.20    {
    1.21 -    int cstat[CPXgetnumcols(env, lp)];
    1.22 -    CPXgetbase(env, lp, cstat, NULL);
    1.23 +    std::vector<int> cstat(CPXgetnumcols(env, lp));
    1.24 +    CPXgetbase(env, lp, &*cstat.begin(), NULL);
    1.25      return (cstat[i]==CPX_BASIC);
    1.26    }  
    1.27  
     2.1 --- a/lemon/lp_glpk.cc	Sat Mar 01 20:07:29 2008 +0000
     2.2 +++ b/lemon/lp_glpk.cc	Sat Mar 01 20:09:40 2008 +0000
     2.3 @@ -64,12 +64,12 @@
     2.4      LEMON_glp(add_rows)(lp, LEMON_glp(get_num_rows)(glp.lp));
     2.5      LEMON_glp(add_cols)(lp, LEMON_glp(get_num_cols)(glp.lp));
     2.6      int len;
     2.7 -    int ind[1+LEMON_glp(get_num_cols)(glp.lp)];
     2.8 -    Value val[1+LEMON_glp(get_num_cols)(glp.lp)];
     2.9 +    std::vector<int> ind(1+LEMON_glp(get_num_cols)(glp.lp));
    2.10 +    std::vector<Value> val(1+LEMON_glp(get_num_cols)(glp.lp));
    2.11      for (int i=1;i<=LEMON_glp(get_num_rows)(glp.lp);++i)
    2.12        {
    2.13 -	len=LEMON_glp(get_mat_row)(glp.lp,i,ind,val);
    2.14 -	LEMON_glp(set_mat_row)(lp, i,len,ind,val);
    2.15 +	len=LEMON_glp(get_mat_row)(glp.lp,i,&*ind.begin(),&*val.begin());
    2.16 +	LEMON_glp(set_mat_row)(lp, i,len,&*ind.begin(),&*val.begin());
    2.17  	LEMON_glp(set_row_bnds)(lp,i,
    2.18  				LEMON_glp(get_row_type)(glp.lp,i),
    2.19  				LEMON_glp(get_row_lb)(glp.lp,i),