[Gambas-user] static const?

Les Hardy les at ...2337...
Wed Apr 14 14:43:20 CEST 2010


>
> The C language, in facts, does not even have CONSTs - it goes with 
> #define. So, it would be correct to forbid STATIC when declaring CONSTs.
Surely this is not correct. ANSI C uses const, and C++ also uses the 
const keyword.
#define (a preprocessor directive) is a relic from old C, and const is 
now recommended use instead.

Also, it would be correct to use static with const, the line below would 
be correct use.

static const int daysPerMonth[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};


Having said that, The original question was not about C,  I think Fabian 
was simply asking about the scope of constants in classes (in Gambas)


Regards
Les Hardy




More information about the User mailing list