[PATCH] dix: silence compiler warning
Mark Kettenis
mark.kettenis at xs4all.nl
Mon Apr 18 02:20:37 PDT 2011
> Date: Mon, 18 Apr 2011 10:01:13 +0100
> From: Daniel Stone <daniel at fooishbar.org>
>
> 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.
More information about the xorg-devel
mailing list