3 ms·
> If you have a `const int i` then the compiler can assume that i never changes. Plus, you can’t even compile your code if you try to modify a const variable.
by bayindirh 3y ago
> If you have a `const int i` then the compiler can assume that i never changes.
Plus, you can’t even compile your code if you try to modify a const variable.
- account42 3y agoThis isn't guaranteed: Modification after const cast on a const variable is ill formed but the compiler is not required to diagnose it - an generally it can't because it doesn't know what your reference/pointer points to.