Tag: 常量正确性

是否有一些忍者诀窍,使其声明后variables常量?

我知道答案是99.99%不,但我认为这是值得一试,你永远不知道。 void SomeFunction(int a) { // Here some processing happens on a, for example: a *= 50; a %= 10; if(example()) a = 0; // From this point on I want to make "a" const; I don't want to allow // any code past this comment to modify it in any way. } 我可以做一些有点类似const int […]