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: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH] use qemu_malloc and friends consistently
Date: Tue, 02 Jun 2009 22:48:14 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2

On 06/02/09 22:42, David Turner wrote:
#define QEMU_NEW(type) ((type *)qemu_malloc(sizeof(type)))
  foo *ptr = QEMU_NEW(foo);

#define QEMU_NEW(ptr) (ptr) = qemu_malloc(sizeof(*(ptr)))
  foo *ptr;
  QEMU_NEW(ptr);

I still don't see the point.

Point is: The first version is nicer than the second, and you are still type safe due to the compiler warning on stuff like this:

foo*  ptr;
ptr = QEMU_MEW(bar);

cheers,
  Gerd




reply via email to

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