Some people use const with every variable that is not meant to change, for the simple reason that it might reduce chance of bugs is complicated code due to dev error. Read More
15. Use const proactively.
const is your friend. Immutable values are easier to understand, track, and reason about, so prefer constants over variables wherever it is sensible and make const your default choice when you define a value. It's safe, it's checked at compile time,
and it's integrated with … Read More
I believe so, once you get into a mindset of using const keyword like that it just becomes natural no matter how non or complex the method is.
It's a really good mindset I think, especially if you're coding in C or C++ with all those pointers knocking around. Read More
I will have to agree with @Suzie999 on this. Once you get into the mindset of using `const` whenever you have a constant value then you should just keep on using it. Not only does it keep the that behavior front an center but it is someting you should always … Read More
Lots of good answers here! In this particular example, const is not required, but may, as indicated by others, allow the compiler to utilize some optimizations which may (or may not) help performance. Read More
> once you get into a mindset of using const keyword like that it just becomes natural no matter how non or complex the method is.
In this example, the notion that the const-qualification may somehow 'allow the compiler to perform some extra optimisations' was true in some … Read More
@vijayan121 I just wanted to let you know about this other online compiler with assembly view: http://goo.gl/64kMZO Read More