“通常c++编译器并不为const创建存储空间“,可以举个例子么?
迷茫
迷茫 2017-04-17 15:35:49
0
2
772

是这样么?如果真的存在,可以举个例子么?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
Ty80

Usually

const c = 10;
a = c;

The compiler compiles directly into

mov [a],10

instead of

mov AX,[c]
mov [a],AX
PHPzhong

Because const modifies a read-only variable, an initial value must be assigned when defining it. This initial value is usually a literal. The compiler will put this literal into the read-only data segment, so the variable does not need to be used during the compilation phase. Storage space, just note it in the symbol table

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template