From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 1 Aug 2007 13:44:13 +0200 (CEST) From: Jan Engelhardt Subject: Re: [RFC PATCH] type safe allocator In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org Return-Path: To: Miklos Szeredi Cc: andi@firstfloor.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, torvalds@linux-foundation.org List-ID: On Aug 1 2007 12:45, Miklos Szeredi wrote: >> > >> > #define k_new(type, flags) ((type *) kmalloc(sizeof(type), flags)) >> >> The cast doesn't make it more safe in any way > >I does, since a warning will be issued, if the type of the assigned >pointer doesn't match the requested allocation. > >And yes, warnings are _very_ useful in C for enforcing type safety. void *p; p = (struct foo *)kmalloc(sizeof(struct foo), GFP_KERNEL); Jan -- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org