SA-MP Forums Archive
redundant code: constant expression is zero - 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: redundant code: constant expression is zero (/showthread.php?tid=506666)



redundant code: constant expression is zero - vardanega - 13.04.2014

Hi everyone

I get this message "warning 205: redundant code: constant expression is zero" with this piece of code when I compile, can be can you give me some help?

thx

Код:
GetNumberOfPages()
{
	if((300 >= 21) && (300 % 21) == 0)
	{
		return (300 / 21);
	}
	else
	{
		return (300 / 21) + 1;
	}
}



Re: redundant code: constant expression is zero - Vince - 13.04.2014

The compiler does constant math. This means that you will just end up with:
pawn Код:
if(false)
{
    return 14;
}
else
{
    return 15;
}
You can't write an if-statement without some kind of variable.


Re : redundant code: constant expression is zero - vardanega - 14.04.2014

Ok thx for you help !