As stated in book Effective C++: "Use const whenever possible.", one would assume that this definition: Vec3f operator+(Vec3f &other);
would be better defined as Vec3f operator+(const Vec3f &other) const;
or even better as const Vec3f operator+(const Vec3f &other) const;
.
Or an example with 5 const keywords: const int*const Foo(const int*const&)const;
Of course, you should only include const where there can be one. What Im asking is it a good practice to use them whenever possible? While it does give you more error safe code, it can get quite messy. Or should you, for example, ignore pointer and reference const (unless you really need it), and use it only on the types itself, as in const int* Foo(const int* parameter)const;
, so it doesnt end up too messy?
Additional info: http://duramecho.com/ComputerInformation/WhyHowCppConst.html
Thanks in advance!