[libvirt] [PATCHv3 00/17] new VIR_(APPEND|INSERT|DELETE)_ELEMENT macros

Eric Blake eblake at redhat.com
Fri Dec 7 22:35:38 UTC 2012


On 12/07/2012 02:24 PM, Laine Stump wrote:
> 
> There's still a couple of disappointments:
> 
> 1) I have to typecast a NULL newelem
> 

Ah, so you DID hit the compile error on *(NULL), and figured that
*((type*)NULL)) works around it.  Yeah, it would be slick if we could
cleanly avoid the need for the typecast, and only check the compile-time
safety on the &orig form.  I'll see if I can come up with anything, but
I'm not holding my breath (making decisions at preprocessor time can be
a lot harder than it seems).

> 2) I had to add the silly "_COPY" versions of the macros because
> sometimes the element being inserted to an array is just a pointer, and
> the caller wants to continue to use that same reference to it after return.

Yeah - we ended up inventing lots of variants, even without adding some
_N arbitrary-size variants into the mix.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121207/223e8ab0/attachment-0001.sig>


More information about the libvir-list mailing list