This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: h8300, m32c and PRIuPTR


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]