I
Ian Collins
Why a preprocessor constant?David said:My arguments about complication come from some of the prohibitions on "magic
numbers". I've been blasted all the time for code like:
if (x > 87192) /* Number of hairs a cat might have. */
{
My counter-argument is that the only time it makes sense to define something
as a preprocessor constant is if:
Why not
const unsigned number_of_hairs_a_cat_might_have = 87192;
Again, if it where an integer constant, your debugger or whatever wouldSome of the code I've seen in my time has made a lot of work for me. For
example, I've seen stuff like:
if (x > UINT8_TWO)
{
If I'm going after a nebulous bug, it means that every time I see something
like that I have to verify the symbol the preprocessor is using. It is
unnecessary work.
be able to show you the value. Preprocessor constants are evil.