CoinUtils icon indicating copy to clipboard operation
CoinUtils copied to clipboard

Compile issues because CoinByteArray is a pointer, no integer

Open christoph-cullmann opened this issue 4 years ago • 2 comments

I get errors with clang 10 like:

In file included from /local/hdd/cullmann/git/3rdparty/cbc/src/CoinUtils/src/CoinPackedVector.cpp:13: /local/hdd/cullmann/git/3rdparty/cbc/src/CoinUtils/src/CoinHelperFunctions.hpp: In function ‘void CoinMemcpyN(const T*, CoinByteArray, T*)’: /local/hdd/cullmann/git/3rdparty/cbc/src/CoinUtils/src/CoinHelperFunctions.hpp:331:57: error: invalid operands of types ‘const CoinByteArray’ {aka ‘int* const’} and ‘int’ to binary ‘operator>>’ 331 | for (CoinBigIndex n = static_cast<CoinBigIndex>(size>>3); n > 0; --n, from += 8, to += 8) { | ~~~~^~~ | | | | | int | const CoinByteArray {aka int* const} /local/hdd/cullmann/git/3rdparty/cbc/src/CoinUtils/src/CoinHelperFunctions.hpp:341:16: error: invalid operands of types ‘const CoinByteArray’ {aka ‘int* const’} and ‘int’ to binary ‘operator%’ 341 | switch (size % 8) { | ~~~~ ^ ~ | | | | | int | const CoinByteArray {aka int* const}

I would assume you want to use a integer type of the right size instead.

Wouldn't size_t fit the bill?

It should be an integer large enough to be used as size/index of any allocated array in memory (both for 32 and 64 systems).

christoph-cullmann avatar May 01 '20 12:05 christoph-cullmann