Recently, I was thinking about Programming Style Standards
and I wonder if I should use e.g.:
kDaysInWeekor
DAYS_IN_WEEK.
Very often I encounter with CONST style instead of kConst, but Google Style Guide says:
Google Style Guide has written
Preferably, the individual enumerators should be named like constants. However, it is also acceptable to name them like macros. The enumeration name, UrlTableErrors (and AlternateUrlTableErrors), is a type, and therefore mixed case.
Hence, the change to prefer constant-style naming was put in place. New code should prefer constant-style naming if possible.
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
enum UrlTableErrors { 	kOK = 0, 	kErrorOutOfMemory, 	kErrorMalformedInput, }; enum AlternateUrlTableErrors { 	OK = 0, 	OUT_OF_MEMORY = 1, 	MALFORMED_INPUT = 2, };
Should I use kConst for Classes and CONST for global constants?