Is there a difference "undef, const, define"
#1

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 
Reply
#2

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.
Reply
#3

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)