Написал вот такой код:
static int cmp(const void* a, const void* b) {
return( ((massifVoltageAndIndex*)a)->Voltage -
((massifVoltageAndIndex*)b)->Voltage );
}
При сборки получил предупреждение "old-style cast" попытался исправить на
static int cmp(const void* a, const void* b) {
return( (reinterpret_cast<massifVoltageAndIndex*>(a))->Voltage -
(reinterpret_cast<massifVoltageAndIndex*>(b))->Voltage );
}
Но получил ошибку:
error: reinterpret_cast from type ‘const void*’ to type
‘massifVoltageAndIndex*’ casts away qualifiers
return( (reinterpret_cast<massifVoltageAndIndex*>(a))->Voltage -
(reinterpret_cast<massifVoltageAndIndex*>(b))->Voltage );
^