Re: Newbie idiotic questions.

Alexander Viro (viro@math.psu.edu)
Sun, 17 Jun 2001 16:37:52 -0400 (EDT)


On Sun, 17 Jun 2001, Daniel Phillips wrote:

> > macro that behaves like `new' in C++:
> > | #define knew(type, flags) (type *)kmalloc(sizeof(type), (flags))
> >
> > If the types in the assignment don't match, gcc will tell you.
>
> Well, since we are still beating this one to death, I'd written a "knew"
> macro as well, and put it aside. It does the assignment for you too:
>
> #define knew(p) ((p) = (typeof(p)) kmalloc(sizeof(*(p)), GFP_KERNEL))

> Terse and clear at the same time, and type safe. I still don't like it much.

And ungreppable, not to mention gratitious use of GNU extension.

-
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/