From owner-freebsd-hackers Thu Jun 7 10:20:57 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from meow.osd.bsdi.com (meow.osd.bsdi.com [204.216.28.88]) by hub.freebsd.org (Postfix) with ESMTP id D59F737B403 for ; Thu, 7 Jun 2001 10:20:54 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241]) by meow.osd.bsdi.com (8.11.3/8.11.2) with ESMTP id f57HKm133192; Thu, 7 Jun 2001 10:20:48 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20010607195634.I724@ringworld.oblivion.bg> Date: Thu, 07 Jun 2001 10:20:51 -0700 (PDT) From: John Baldwin To: Peter Pentchev Subject: Re: free() and const warnings Cc: hackers@FreeBSD.org Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 07-Jun-01 Peter Pentchev wrote: > On Thu, Jun 07, 2001 at 07:07:22PM +0300, Peter Pentchev wrote: >> Hi, >> >> Is free((void *) (size_t) ptr) the only way to free a const whatever *ptr >> with WARNS=2? (or more specifically, with -Wcast-qual) > > Uhm. OK. So size_t may not be enough to hold a pointer. What is it then - > caddr_t? uintptr_t for data pointers. In theory I think code pointers may not fit in a uintptr_t. free((void *)(uintptr_t)ptr) should work. Of course, this begs the question of why you are free'ing a const. :) -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message