|
The const modifier only tells the compiler that it shouldn't allow you to write code that modifies that value. It's a convention, an agreement between you and the compiler that you are a screw-up, and the compiler is allowed to warn you when you do it. Declaring something const does NOT make it actually write protected (normally; one could build a system that did that, in cooperation with the compiler).
In Tempest's case, he is on an OS that has actually flagged that memory as read-only. Trying to write to it causes a system fault. Had he realized that many modern systems would do that, and realized that it WAS write protected, he could have declared it const so that the compiler would remind him if he forgot. That isn't germane. It isn't that he forgot, it's merely that he was unaware of the restrictions imposed on him by his particular implementation. A declaration like that is not, defacto, write protected. It just is in many implementations.
|