This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: h8300, m32c and PRIuPTR
- From: Nicholas Clifton <nickc at redhat dot com>
- To: Joel Sherrill <joel dot sherrill at oarcorp dot com>, "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Mon, 16 Mar 2015 10:22:07 +0000
- Subject: Re: h8300, m32c and PRIuPTR
- Authentication-results: sourceware.org; auth=none
- References: <5506017E dot 8080301 at oarcorp dot com>
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