qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] use qemu_malloc and friends consistently


From: Paul Brook
Subject: Re: [Qemu-devel] [PATCH] use qemu_malloc and friends consistently
Date: Tue, 2 Jun 2009 19:13:08 +0100
User-agent: KMail/1.11.2 (Linux/2.6.29-2-amd64; KDE/4.2.2; x86_64; ; )

> >  QEMU_NEW_ARRAY(ptr, ...);
> >
> > instead of
> >
> >  ptr = QEMU_NEW_ARRAY(...);
> >
> > then.  I don't see another easy way to get the automagic sizeof(*ptr)
> > stuff done though.
>
> The first version will extract the item size automatically for you, making
> it less likely that you screw things in the second version's parameter
> list.

Not if you do it properly it won't. Implicit casts are only silently allowed 
between void* and arbitrary pointers. A cast between two arbitrary pointers 
will generate a compiler diagnostic.

Paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]