h8300, m32c and PRIuPTR

Nicholas Clifton nickc@redhat.com
Mon Mar 16 10:22:00 GMT 2015


Hi Joel,

> The warning is:
>
> f.c:6:3: warning: format '%u' expects argument of type 'unsigned int',
> but argument 2 has type 'uintptr_t' [-Wformat=]
>     printf( "%" PRIuPTR "\n", x );

> Any ideas on how to address this?

How about using an explicit widening cast, as in:

       printf ("%lu\n", (unsigned long) x);


I am assuming that sizeof (uintptr_t) <= sizeof (unsigned long) will
always be true, but that seems reasonable to me.

Cheers
   Nick



More information about the Newlib mailing list