I want to know about const internals in c and c++ . How compiler imposes constantness ? Can some one help me please.
See Question&Answers more detail:osI want to know about const internals in c and c++ . How compiler imposes constantness ? Can some one help me please.
See Question&Answers more detail:osIn general const
is 100% compiler. When you declare something const, the compiler places restrictions on what it will let you write. It won't let you assign to const scalar, assign through a const reference or or pointer, or invoke a non-const function of const object.
There is no guarantee that the compiler will arrange any sort of runtime protection.