SA-MP Forums Archive
strcmp - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: strcmp (/showthread.php?tid=622070)



strcmp - iLearner - 18.11.2016

Ye i know this might be a foolish question, but i dont want any risks and thus will ask before doing stuff.

we use !strcmp(.... with the ! before strcmp to check if they are same, but how do i check if they arent same?? (dont tell me to do if(!strcmp(... ) else (...)). do i remove the ! ?


Re: strcmp - GoldenLion - 18.11.2016

Yes, you remove the ! because if you use ! it's basically the same thing as == 0 and if you remove it then it's the same thing as > 0.


Re: strcmp - iamjems - 18.11.2016

Код:
if(strcmp(string1,string2,true) == 0)
to

Код:
if(strcmp(string1,string2,true) != 0)
It's the same exact thing as GoldenLion has suggested you to do.


Re: strcmp - iLearner - 18.11.2016

Quote:

Header size: 16808 bytes
Code size: 981680 bytes
Data size: 17509204 bytes
Stack/heap size: 25600 bytes; estimated max. usage: unknown, due to recursion
Total requirements:18533292 bytes

Comments please.


Re: strcmp - GoldenLion - 18.11.2016

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Comments please.
This doesn't do anything as far as I know and only shows up if you compile with debug info. But I heard you can do something with pragma dynamic, I'm not sure. I don't know anything about that lol.


Re: strcmp - iamjems - 18.11.2016

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Comments please.
Normal thing when you use the -d3 debug setting.


Re: strcmp - Micko123 - 18.11.2016

Quote:
Originally Posted by Vince
Посмотреть сообщение
If it showed up because you compiled with -d3 or -v, then no. You should only be worried if the estimated max exceeds the stack size.
Ask him


Re: strcmp - Konstantinos - 18.11.2016

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
[..] and if you remove it then it's the same thing as > 0.
Not equal to 0, it can be both negative or positive number.

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
[..] But I heard you can do something with pragma dynamic, I'm not sure.
Quote:
Originally Posted by iamjems
Посмотреть сообщение
Normal thing when you use the -d3 debug setting.
Код:
Stack/heap size: 25600 bytes; estimated max. usage: unknown, due to recursion
By default, it is 16384 bytes so #pragma dynamic has been used. Recursion is another reason it'd pop out. You shouldn't worry unless you get a run time error but it is still advised to use smaller local strings.


Re: strcmp - GoldenLion - 18.11.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Not equal to 0, it can be both negative or positive number.
Right, I totally forgot about that.


Re: strcmp - iLearner - 27.11.2016

I didnt mean why is it there... I meant, what do those numbers say? how much memroy / ram is it going to require.