• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

warning: comparison between signed and unsigned integer expressions (help)

Powers

New Member
Joined
May 10, 2010
Messages
19
Reaction score
0
Hi, I wrote this little code, and when compiling an error occurs...

Code:
Player* playerNow = getPlayer();
              uint32_t storageId = g_config.getNumber(ConfigManager::PLAYER_BATTLE_STORAGE);
              std::string value;
              std::string value2;
              
                 if (targetPlayer->getStorageValue(storageId, value) && atoi(value.c_str()) == playerNow->getGUID() && getStorageValue(storageId, value2) && atoi(value2.c_str()) == targetPlayer->getGUID())                                    

                    return;

Error:

player.cpp: In member function 'virtual void Player::eek:nAttackedCreature(Creature*)':
player.cpp:3555: warning: comparison between signed and unsigned integer expressions

why this is happening?
 
Code:
Player* playerNow = getPlayer();
	uint32_t storageId = g_config.getNumber(ConfigManager::PLAYER_BATTLE_STORAGE);
	std::string value, value2;
	if(targetPlayer->getStorageValue(storageId, value) && atoi(value.c_str()) == (int)playerNow->getGUID() && getStorageValue(storageId, value2) && atoi(value2.c_str()) == (int)targetPlayer->getGUID())                                    
		return;
also its not an error, its just a warning, u can ignore it
 
Last edited:
Back
Top