SA-MP Forums Archive
Is there a difference "undef, const, define" - 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: Is there a difference "undef, const, define" (/showthread.php?tid=483838)



Is there a difference "undef, const, define" - Manowar - 27.12.2013

Is there a difference how to write and which option is best

1.
PHP код:
#undef MAX_PLAYERS
const MAX_PLAYERS 10
2.
PHP код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 10 



Re: Is there a difference "undef, const, define" - nmader - 28.12.2013

Personally I would prefer the second, because I'm most familiar with it. I think most people are more familiar with the second;l however I believe it is a matter of opinion.


Re: Is there a difference "undef, const, define" - park4bmx - 28.12.2013

const is a modifier, it must go with new or another variable declarator.
Can be used as a define that can hold an array


Re: Is there a difference "undef, const, define" - Ada32 - 28.12.2013

const tells the compiler that this is unchangeable, #define changes all instances at compilation