??? 02/21/11 11:40 Read: times |
#181203 - lint can be too noisy if you ask it to Responding to: ???'s previous message |
You really need to test if you get any advantage from it.
1 - having a variable or parameter that isn't modified configured const should not make the code larger or slower. It is more a hint in the other direction - that the compiler can be more aggresive with the optimization. 2 - optimizing compilers should be quite able to figure out themselves that the parameter is never modified, meaning they can produce the same code with or without the const keywored. 3 - if making a parameter const, then you prototype must also use the const keyword. 4 - the biggest advantage with const, is that you get a compilation error if you later try to modify the function so that the compiler can't anymore take advantage of the parameter being const. |
Topic | Author | Date |
const function parameter declaration | 01/01/70 00:00 | |
lint can be too noisy if you ask it to | 01/01/70 00:00 | |
const correctness![]() | 01/01/70 00:00 |