Messages in this thread | | | Date | Mon, 14 Jan 2013 09:18:11 +0800 | From | Chen Gang F T <> | Subject | Re: Why is the kfree() argument const? |
| |
于 2013年01月14日 04:54, Cong Ding 写道: > On Sun, Jan 13, 2013 at 9:10 AM, Chen Gang F T > <chen.gang.flying.transformer@gmail.com> wrote: >> > all together: >> > kfree() should use 'const void *' as parameter type >> > the free() of C Library is incorrect (it use void *). > you are definitely wrong. both of them are correct - it's the > difference between kernel space and user space. >
for API features, they are should be no different.
"- 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."
"we want the types to be as tight as possible"
so should use 'const void *' both for 'kfree()' and 'free()' .
-- Chen Gang
Flying Transformer begin:vcard fn:Chen Gang n:;Chen Gang version:2.1 end:vcard
| |