How is “const” implemented?

前端 未结 5 496
灰色年华
灰色年华 2021-02-06 04:30

How does a compiler, C or C++, (for example, gcc) honors the const declaration?

For example, in the following code, how does the compiler keeps trac

5条回答
  •  隐瞒了意图╮
    2021-02-06 05:10

    Of course it is up the implementation of each compiler, but in a nutshell, it stores the variable's const and volatile qualifiers (if any) in its variable symbol table along with other information such as the variable's type and whether or not it is a pointer / reference.

提交回复
热议问题