From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758723AbYAPXXn (ORCPT ); Wed, 16 Jan 2008 18:23:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757210AbYAPXSn (ORCPT ); Wed, 16 Jan 2008 18:18:43 -0500 Received: from smtp2.linux-foundation.org ([207.189.120.14]:41174 "EHLO smtp2.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756339AbYAPXSm (ORCPT ); Wed, 16 Jan 2008 18:18:42 -0500 Date: Wed, 16 Jan 2008 15:18:33 -0800 (PST) From: Linus Torvalds To: Christoph Lameter cc: Johannes Weiner , Linux Kernel Mailing List , penberg@cs.helsinki.fi Subject: Re: Why is the kfree() argument const? In-Reply-To: Message-ID: References: <87lk6pvii0.fsf@saeurebad.de> <87odblct19.fsf@saeurebad.de> User-Agent: Alpine 1.00 (LFD 882 2007-12-20) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 16 Jan 2008, Christoph Lameter wrote: > > 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? Either don't use a broken compiler (casting a const pointer to a non-const is definitely not a bug), or cast to "unsigned long" (if it still complains, now the compiler is not just stupid, it's broken). The whole point of memory management is that we know how pointers work, and understand that they have a *bit* representation, not just the C semantics. Linus