On Wed, Jan 25, 2012 at 05:54:19PM -0700, Eric Blake wrote:
On 01/25/2012 05:22 PM, Marc-André Lureau wrote:
>> the decision should _not_ be based on _WIN64, but instead on a
>> configure-time test on the underlying type of pid_t. And since
>> _that_
>> gets difficult, I'd almost rather go with the simpler approach of:
>>
>> "%" PRIdMAX, (intmax_t) pid
>>
>> everywhere that we currently use
>>
>> "%d", pid
>>
>
> I thought about using that solution, but I prefer the format macro.
> Tbh, I wish some of these would be part of gnulib (perhaps some
already are).
Sadly, no one has made a case for extended type macros in gnulib. And
mingw points out the problem - we can't use "lld" nor PRIdMAX for pid_t,
since we don't know whether the code is targetting gnu printf, windows
printf, or a mix. I really do think we're stuck with casting to (long
long) or (intmax_t) in this case :(
But we can use 'lld' because we made sure all libvirt code goes
via the gnulib printf replacements which guarentee %lld works
correctly.
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|