The answer depends on the compiler. In my experience, no, it doesn't make a difference, but using some of the new C++ features such as constexpr can make a difference. The advantage of "const" is that it helps the programmer to manage object ownership, write permissions, etc. This makes the code easier to understand and reduces the chances of mistakes. Sometimes "const" is required when using libraries/APIs that enforce cons correctness.
8
u/314kabinet Aug 14 '22
Congrats! But for god’s sake, use const.