q for the C hackers
Erik Price
erikprice at mac.com
Mon Aug 18 20:13:05 EDT 2003
When I want to define a constant value in Java, such as a magic number,
I usually use "public static final":
public static final int NUMBER_OF_UNITS = 8;
However, what is the convention in C? There seem to be two fine ways
of doing it -- using the preprocessor, or the const keyword:
#define NUMBER_OF_UNITS 8
const int NUMBER_OF_UNITS = 8;
I'm just interested in hearing about whether one is more appropriate
than the other in some contexts. Thanks.
Erik
More information about the gnhlug-discuss
mailing list