Jim Meyering <[email protected]> writes:
> By "local variables" you must mean "local scalar variables".
> You wouldn't argue for dropping "const" as a pointer attribute.
Yes, that's right. That is, it's fine to have this:
{
char const *p = &a[i];
...
}
because the 'const' is talking about p's value, not about p itself, and
the value's const-ness is often non-obvious. In constrast, it's dubious
to have this:
{
char *const p = &a[i];
...
}
because this 'const' is talking about p itself, and p is a local
variable so it is typically obvious (by inspecting the "...") whether p
varies.
> In any case, don't worry: I'm not about to add "const"
> to all scalar declarations.
Yay! Thanks.