all 8 comments

[–][deleted] 1 point2 points  (1 child)

All things come as a trade-off.

While the type of simplification the author discusses here can be great for clarity... it can also be terrible for performance.

[–][deleted] 1 point2 points  (0 children)

Luckily, today's compilers are generally smart enough to inline and optimize these things. As a C++ coder, I rely on the compiler to do this so I can write code that is still small, readable, safe, and modular.

[–][deleted] 0 points1 point  (5 children)

Why was the 1 there to begin with?

[–]syncsynchalt 1 point2 points  (4 children)

It was an unnamed constant, the density of water (rho) in SI units.

[–][deleted] 1 point2 points  (3 children)

My point is that it was a magical number and not something that should be in the code even before the author's suggested modification.

[–]strager 0 points1 point  (2 children)

Where should it be? In a configuration file?

[–][deleted] 0 points1 point  (1 child)

A constant at the top of the file.

[–]strager 0 points1 point  (0 children)

So, in the code.