Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

More on LinuxToday


C Semantics, Constants and Pointers

Jan 19, 2008, 21:00 (28 Talkback[s])

"''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...'"

Complete Story

Related Stories: