Jump to content

Recommended Posts

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

File cannot be downloaded, please post in CODE-tag here so we can help you with it.

 

The problem is just a warning. You have a comparison in this very line that always leads to false. And why is that so? Well, the warning pretty much explains it: Limited range of data types. Since it looks like you tried to upload char_item.cpp I'll give you an example of this error:

 

unsigned int itemid = GetID(); //GetID() is defined in item.h and returns DWORD, which equals unsigned int

if(itemid < 0) //Comparison always false due to unsigned int being unable to hold a negative value.
{
  //Will never be executed!
}

In this example we call GetID() which is defined in item.h and returns a DWORD value. DWORD equals unsigned int. And as we know, unsigned means that this variable cannot contain negative values. If we now try to do the comparison like above (check if it's lower than 0, meaning negative value) then the comparison is always false. You'd cast it to int datatype but that's very tricky and not recommended. Especially since you're dealing with a comparison here... You can also just edit the comparison to be more reasonable with the datatype. If you by any chance get the same problem with with function calls to APIs you may or may not be forced to cast it to int instead. I recommend you reading further information if you wanna do this (for example https://www.pluralsight.com/blog/software-development/convert-unsigned-int-to-signed-int).

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.