SA-MP Forums Archive
Const in Parameters - 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: Const in Parameters (/showthread.php?tid=434877)



Const in Parameters - AlexSkyrise - 04.05.2013

Hi guys,

Why some peoples adding Const in function Parameters? what is this for?


Код:
dCmd_siren(const playerid, const params[])
{
...
}
Thanks.


Re: Const in Parameters - RajatPawar - 04.05.2013

To quote it from the wiki:
Quote:

const is not widerly used however it declares a variable which can not be modified by code. There are a few uses for this - functions with const array parameters can sometimes be compiled more efficiently or you may want something like a define but which is an array. const is a modifier, it must go with new or another variable declarator. If you try modify a const variable the compiler will complain.