Well, of course:<p><pre><code> void constByArg(const int *x)
{
printf("%d\n", *x);
constFunc(x);
printf("%d\n", *x);
}
</code></pre>
Here, the object referenced by pointer <i>x</i> is non-local, and so is <i>constFunc</i>.<p>The object could be modified in legal ways nothing to do with <i>constFunc</i> stripping away the qualifier.<p>Also, if the object is not <i>defined</i> const, then <i>constFunc</i> is allowed to do that, too.<p>Then the next, correct, example with a const protected local shows that two instructions are shaved off. That's a wortwhile saving that could be leveraged to get faster code.<p>If you're passing local variables into helper functions which are not supposed to change them, you can shave off some cycles with const.<p>> <i>I mean, I removed const from the entire program</i><p>Maybe sqLite doesn't use <i>const</i> specifically with a view toward optimization. To see an overall performance impact, there would have to be some case in a "hot spot" of the program, where <i>const</i> is used with some local variables being passed into functions. (Or whatever other case we can ferret out where <i>const</i> happens to help.)<p>There are some widely applicable optimizations which scoop up all the "low hanging fruit" improvements, but after that, optimization is a game of eking out small gains with specialized cases.