login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
August
»
2
Re: [PATCH] type safe allocator
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From:
Miklos Szeredi <miklos@...>
To: <jengelh@...>
Cc: <adobriyan@...>, <miklos@...>, <akpm@...>, <linux-kernel@...>, <linux-mm@...>, <torvalds@...>
Subject:
Re: [PATCH] type safe allocator
Date: Thursday, August 2, 2007 - 9:06 am
> On Aug 2 2007 16:04, Alexey Dobriyan wrote:
quoted text
> >On 8/2/07, Miklos Szeredi <miklos@szeredi.hu> wrote: > >> fooptr = kmalloc(sizeof(struct foo), ...); > > > >Key word is "traditional". Good traditional form which even half-competent > >C programmers immediately parse in retina. > > And being aware of the potential type-unsafety makes programmers more > careful IMHO.
That's a _really_ good reason ;)
quoted text
> >> +/** > >> + * alloc_struct - allocate given type object > >> + * @type: the type of the object to allocate > >> + * @flags: the type of memory to allocate. > >> + */ > >> +#define alloc_struct(type, flags) ((type *) kmalloc(sizeof(type), flags)) > > >someone will write alloc_struct(int, GFP_KERNEL), I promise. > > and someone else will write > > struct complexthing foo; > alloc_struct(foo, GFP_KERNEL);
And the compiler will complain like mad about that. Miklos -
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] type safe allocator
, Miklos Szeredi
, (Thu Aug 2, 7:31 am)
Re: [PATCH] type safe allocator
, Andrew Morton
, (Thu Aug 2, 2:36 pm)
Re: [PATCH] type safe allocator
, Miklos Szeredi
, (Thu Aug 2, 2:48 pm)
Re: [PATCH] type safe allocator
, Alexey Dobriyan
, (Thu Aug 2, 8:04 am)
Re: [PATCH] type safe allocator
, Peter Zijlstra
, (Thu Aug 2, 9:47 am)
Re: [PATCH] type safe allocator
, Bernd Petrovitsch
, (Thu Aug 2, 10:06 am)
Re: [PATCH] type safe allocator
, Jan Engelhardt
, (Thu Aug 2, 10:08 am)
Re: [PATCH] type safe allocator
, Jan Engelhardt
, (Thu Aug 2, 8:24 am)
Re: [PATCH] type safe allocator
, Miklos Szeredi
, (Thu Aug 2, 9:06 am)
Re: [PATCH] type safe allocator
, Jan Engelhardt
, (Thu Aug 2, 9:35 am)
Re: [PATCH] type safe allocator
, Miklos Szeredi
, (Thu Aug 2, 9:49 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Pavel Emelianov
[RFC][PATCH 4/7] RSS accounting hooks over the code
Avi Kivity
[PATCH 03/54] KVM: MMU: Rename variables of type 'struct kvm_mmu_page *'
Alan
Re: [RFC] Heads up on sys_fallocate()
debian developer
Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3
git
:
openbsd-misc
:
linux-netdev
:
David Miller
Re: 2.6.25-rc8: FTP transfer errors
Gerrit Renker
[PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side)
Jarek Poplawski
[PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
Neil Horman
Re: [RFC] net: release dst entry in dev_queue_xmit()
Colocation donated by:
Who's online
There are currently
3 users
and
893 guests
online.
Online users
rejupal
penelop321
Jeremy
Syndicate