RainerKuemmerle / g2o

g2o: A General Framework for Graph Optimization
3.08k stars 1.11k forks source link

should use size_t instead of int? #36

Open ioquatix opened 10 years ago

ioquatix commented 10 years ago

https://github.com/RainerKuemmerle/g2o/blob/master/g2o/core/sparse_block_matrix.hpp#L216-L221

Proposed fix:

    size_t colM=i;
    const typename SparseBlockMatrix<MatrixFactorType>::SparseMatrixBlock *b=it->second;
    typename SparseBlockMatrix<MatrixType>::IntBlockMap::const_iterator rbt=_blockCols[it->first].begin();
    while(rbt!=_blockCols[it->first].end()){
      //int colA=it->first;
      size_t rowA=rbt->first;

assigning size_t to int truncates the value.

ioquatix commented 10 years ago

I'm not sure if this helps, but in my mind, explicit casting is a hack and not a real solution, except in very specific situations.

ioquatix commented 10 years ago

Any update on this?

RainerKuemmerle commented 10 years ago

Not so far. I guess, it's also kind of low priority or do I miss any other issues (despite compiler warnings).

On Tue, Oct 28, 2014 at 2:16 AM, Samuel Williams notifications@github.com wrote:

Any update on this?

— Reply to this email directly or view it on GitHub https://github.com/RainerKuemmerle/g2o/issues/36#issuecomment-60696630.