C Semantics, Constants and Pointers
Jan 19, 2008, 21:00 (28 Talkback[s])
Re-Imagining Linux Platforms to Meet the Needs of Cloud Service Providers
"''Const' has *never* been about the thing not being modified.
Forget all that claptrap. C does not have such a notion,' began
Linus Torvalds, responding to a query about why kfree() takes a
const pointer. He continued, ''const' is a pointer type issue, and
is meant to make certain mis-uses more visible at compile time. It
has *no* other meaning, and anybody who thinks it has is just
setting himself up for problems.' He offered two explanations,
beginning with simple C semantics, 'from a very obvious and very
*real* caller perspective, 'free()' really doesn't change the thing
the pointer points to. It does something totally different: it
makes the *pointer* itself invalid...'"