I have run across a bunch of code in a few C# projects that have the following constants:
const int ZERO_RECORDS = 0; const int FIRST_ROW = 0; const int DEFAULT_INDEX = 0; const int STRINGS_ARE_EQUAL = 0;
Has anyone ever seen anything like this? Is there any way to rationalize using constants to represent language constructs? IE: C#'s first index in an array is at position 0. I would think that if a developer needs to depend on a constant to tell them that the language is 0 based, there is a bigger issue at hand.
The most common usage of these constants is in handling Data Tables or within 'for' loops.
Am I out of place thinking these are a code smell? I feel that these aren't a whole lot better than:
const int ZERO = 0; const string A = "A";