
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