> Date: Mon, 18 Apr 2011 10:01:13 +0100
> From: Daniel Stone <[email protected]>
> 
> Hi,
> 
> On Mon, Apr 18, 2011 at 09:26:54AM +0200, Mark Kettenis wrote:
> > > resource.c: In function 'AddResource':
> > > resource.c:493:3: warning: format '%lx' expects type 'long unsigned int=
> ',
> > > but argument 3 has type 'RESTYPE'
> > >=20
> > > RESTYPE is uint32_t, not long.
> >=20
> > Well, uint32_t isn't a fundamental type.  And while the most natural
> > thing on ILP32 and LP64 systems is to typedef it as unsigned int, it
> > may actually be unsigned long on some systems.  It probably is on Windows.
> 
> Right.  So, glibc supports PRIu32 and friends in stdint.h so you can do
> this:
>     uint32_t foo =3D 0xabcdef01;
>     printf("uint32_t: %"PRIu32"\n", foo);
> 
> But it's non-portable, and also seriously ugly.  Oh well.

Those are actually defined by C99, so they should be as portable as
the uint32_t typedef itself.  But I agree that they're seriously ugly.
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to