Const in Parameters
#1

Hi guys,

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


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

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.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)