Help me fast.
#6

Quote:
Originally Posted by NaS
Посмотреть сообщение
It is the same in this case (of course yours isn't wrong, but you don't have to do it, nor is it the solution here). Because any number greater than 0 is considered true, that will make it valid - so any length but 0 will execute the code within the if statement.

This cannot technically be the cause for Warning 225. strlen() returns a value that isn't known at compile time - thus regardless which checks are done the code in brackets can potentially always be executed in a specific case - so it is in theory always reachable. Also the Compiler doesn't know that strlen can only return positive values or zero, so even if you do if(strlen(string) < 0) that warning will not be thrown.
Oh thanks, you learn a new thing everyday!
Reply


Messages In This Thread
Help me fast. - by Smokinn - 20.05.2017, 16:05
Re: Help me fast. - by Smokinn - 20.05.2017, 16:35
Re: Help me fast. - by Affan - 23.05.2017, 15:55
Re: Help me fast. - by Vince - 23.05.2017, 16:32
Re: Help me fast. - by NaS - 23.05.2017, 17:37
Re: Help me fast. - by Affan - 24.05.2017, 06:37

Forum Jump:


Users browsing this thread: 2 Guest(s)