What does compile time 'const' mean?

后端 未结 6 1433
执笔经年
执笔经年 2020-12-10 14:49

They say the difference between readonly and const is that const is compile-time (while readonly is run time). But what exactly does that mean, The fact that it\'s compile t

6条回答
  •  一向
    一向 (楼主)
    2020-12-10 15:18

    Typically, a "compile-time constant" would refer to a constant literal value that the compiler would resolve. The code that the compiler generates will have the constnat value available as an immediate operand, instead of having to load it from memory.

提交回复
热议问题