lkml.org 
[lkml]   [2008]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Why is the kfree() argument const?
Date
Hi,

Christoph Lameter <clameter@sgi.com> writes:

> On Wed, 16 Jan 2008, Johannes Weiner wrote:
>
>> So if I got it right and you actually modify the memory you only got a
>> const pointer to, you reach a level where you _have to_ break this
>> policy and cast to a non-const pointer, as it is currently done in
>> kfree(). No?
>
> Correct and we have gcc 4.2 currently spitting out warnings because of
> casting to non const. Any idea how to convince gcc that this is okay?

Two dirty hacks where gcc at least does not complain:

void *y = (void *)x;

and then pass y, or passing

*(void **)&x

directly.

Both approaches seem just too ugly to silence a bogus warning.

Hannes


\
 
 \ /
  Last update: 2008-01-16 23:39    [W:0.048 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site