On 12/30/2011 09:10 AM, Paul Eggert wrote: > On 12/30/11 05:49, Eric Blake wrote: >> the gnulib replacement for stat on some platforms has to be a function-like >> macro (no thanks to 'struct stat') > > Why does the gnulib replacement do that? > If gnulib instead did "#define stat rpl_stat", > that would rename 'struct stat' to 'struct rpl_stat', > but the resulting code would work fine, no?
No, because unless you can declare struct rpl_stat with the same layout as struct stat, you have an API incompatibility that can cause compilation errors in various circumstances. > And we wouldn't have the problem that sparked this thread. I'd welcome a patch to gnulib to prove me wrong by fixing rpl_stat to be an object-like instead of function-like macro, all while still allowing compilation to succeed in all interfaces that take 'struct stat *' as a parameter, including when using those interfaces via function pointer. -- Eric Blake ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature