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.