Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible misuse of comma operator here

I'm getting warnings in Xcode after updating to the recommended pod settings. The warning is

Possible misuse of comma operator here

with a suggested fix of

Cast expression to void to silence warning

The warnings occur in leveldb-library/db/c.cc at the start and limit keys:

void leveldb_compact_range(
    leveldb_t* db,
    const char* start_key, size_t start_key_len,
    const char* limit_key, size_t limit_key_len) {
  Slice a, b;
  db->rep->CompactRange(
      // Pass NULL Slice if corresponding "const char*" is NULL
      (start_key ? (a = Slice(start_key, start_key_len), &a) : NULL),
      (limit_key ? (b = Slice(limit_key, limit_key_len), &b) : NULL));
}

Has anyone else had the same or know what's causing it? I'm running Cocoapods 1.2.0.

like image 332
Shane O'Seasnain Avatar asked Oct 23 '17 17:10

Shane O'Seasnain


3 Answers

leveldb now builds without warnings after a pod update to version 1.20 of the leveldb-library CocoaPod.

like image 52
Paul Beusterien Avatar answered Nov 05 '22 02:11

Paul Beusterien


This solution works for me.

Code:

 if (++keyIndexValue == [self.str length])
    keyIndexValue = 0, keyPtr = keyData;

I've solved it by splitting the statements over multiple lines within the "if" condition:

"If at end of key data, reset count and set key pointer back to start of key value"

if (++keyIndexValue == [self.str length])
{
   keyIndexValue = 0;
   keyPtr = keyData;
}
like image 20
Gajendra K Chauhan Avatar answered Nov 05 '22 01:11

Gajendra K Chauhan


We are aware of the warning, we'll update the version once the leveldb fixes the issue. For now you can ignore the warnings.

like image 1
Ibrahim Ulukaya Avatar answered Nov 05 '22 02:11

Ibrahim Ulukaya