SA-MP Forums Archive
define - IF - 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: define - IF (/showthread.php?tid=385939)



define - IF - Swimor - 18.10.2012

Hello,

I have this code:
Код:
#define IF_TRUE(%0)  if((%0))
I using this like this:
Код:
    IF_FALSE(true) {
		printf("Sdasdsa");
	}
And the warning:
warning 205: redundant code: constant expression is zero

What do to?


Re: define - IF - Roel - 18.10.2012

What is this?
And what is it doing? (should do) ?


Re: define - IF - Swimor - 18.10.2012

Try to understand... check if the param is false..


Re: define - IF - Vince - 18.10.2012

This doesn't make any sense whatsoever. An if-statement always needs to evaluate to true for the code in the block to be executed. If you need to invert the statement, use the NOT operator (exclamation mark).


Re: define - IF - Swimor - 18.10.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
This doesn't make any sense whatsoever. An if-statement always needs to evaluate to true for the code in the block to be executed. If you need to invert the statement, use the NOT operator (exclamation mark).
Please, don't commant if you not helping.

You must look on the code befor commant, I want to do define that have IF...


Re: define - IF - Vince - 18.10.2012

Still, I do not understand what it is that you're actually trying to achieve. This isn't something a professional programmer would ever consent to write.

You might want to do something about your English as well. "I want to do define that have IF..." is not an understandable sentence.


Re: define - IF - Mauzen - 18.10.2012

The warning just tells you, that this code phrase is useless, as its behaviour is already known on compilation, and so could also be left out.
It doesnt cause any problems however, you can just ignore it if you want to produce inefficient but still working code.