How is “const” implemented?

前端 未结 5 508
灰色年华
灰色年华 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:12

    I'm sure others can elaborate more, but in short, yes. The compiler keeps track of all type specifiers so that it knows that ci is of type "const int", and not "int".

提交回复
热议问题