[Spice-devel] [PATCH spice-server 01/33] Use PRIxPTR constant for string formatting

Christophe Fergeau cfergeau at redhat.com
Wed Jan 2 12:52:28 UTC 2019


On Sat, Dec 22, 2018 at 10:02:36AM -0500, Frediano Ziglio wrote:
> > 
> > On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio <fziglio at redhat.com> wrote:
> > >
> > > These constants are meant to be used in format string for size_t
> > > types. Use them for portability.
> > 
> > PRI*PTR is for [u]intptr_t.
> > 
> > There are some claims that z is supported since VC2015 on stackoverflow.
> > 
> 
> They are right, msdn states the same. But is up to the CRT you are using,
> MingW without __USE_MINGW_ANSI_STDIO does not accept it.
> On the other hand I64 is always supported.
> 
> > I assume we are mainly interested in mingw, we should set
> > __USE_MINGW_ANSI_STDIO=1 instead.
> > 
> 
> Mainly does not mean only. I suppose here you mean "we could use
> __USE_MINGW_ANSI_STDIO for MingW and assume other compiler uses
> newer CRT libraries supporting 'z' modifier". In that case 'z'
> could be used for size_t. 'l' is not an option for pointers as
> Windows 64 is LLP64 while Linux 64 is LP64 so for pthread_id
> PRIxPTR looks fine for me.
> 
> Is there a specific PRIxxxx constant for size_t type?

I don't think so, I could not find any when I sent
https://lists.freedesktop.org/archives/spice-devel/2018-September/045611.html

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190102/a76b7b1a/attachment.sig>


More information about the Spice-devel mailing list