As stated in book Effective C++: \"Use const whenever possible.\", one would assume that this definition: Vec3f operator+(Vec3f &other); would be b
The original purpose of const is to deal with problems, which arise when you use magic numbers and hard-coded values in general.
A bit stupid, but picturesque example to show the point. Such code is error-prone and inconvenient.
c1 = 3.14159 * diameter1;
c2 = 3.14159 * diameter2;
You'd rather be better defining Pi as a constant.
const double PI = 3.14159;
c1 = PI * diameter1;
c2 = PI * diameter2;
Compared to variables constants have "priviliges". In your example it makes sense to pass other vector by const reference, because thanks to this function will accept temporary (rvalue) as its parameter.
Vec3f operator+(const Vec3f &other) const;
// Would not be possible with Vec3f operator+(Vec3f &other) const;
Vec3f v = u + Vec3f(1, 0, 0);
With constexpr you can use constants in contexts such as for example static array allocation
constexpr std::size_t LENGTH = 10;
int arr[LENGTH];
So it's not to prevent you from accidentally setting some random value (you would have to be exceptionally stupid programmer to make such mistakes). It does not make sense to use it whenever possible, but only when you want to specify a constant.
This is not the first time I see weird statements from "Effective C++".