Const Syntax
The omission of const correctness in code is a big pet peeve of mine.
Quick, what's the difference between:
const char * CONSTANT_STRING_TABLE[] = {
"A",
"B",
"C"
};
and:
const char * const CONSTANT_STRING_TABLE[] = {
"A",
"B",
"C"
};
?
Unfortunately, the former lets you modify the strings in the CONST_STRING_TABLE:
CONST_STRING_TABLE[0] = "B";
while the latter doesn't (which is probably what you wanted), generating a compiler error instead. But I know I've seen the former plenty of times when reading through peoples' code. That, along with the following, drive me up the wall whenever I run into them.
const char * CONSTANT_STRING = "Some \"constant\" string.";
- ← Previous
FlurryAgent - Next →
Symmetric Earbuds