3 ms·
Agreed. All of the top 3 answers focus on the numbers being directly used in code which is not the real reason why magic numbers cause problems. They are bad b
by praptak 13y ago
Agreed. All of the top 3 answers focus on the numbers being directly used in code which is not the real reason why magic numbers cause problems.
They are bad because of not being explained. A number directly used in code is not magic if it is properly commented. Granted, explaining it by making it a named constant is very often better (reusability), but a literal number that is merely commented is not "magic".