libftdi Archives

Subject: Re: libftdi-1.0: examples/streamtest.c: Fix fromatting warnings

From: Jim Paris <jim@xxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sun, 26 Sep 2010 11:24:16 -0400
Uwe Bonnes wrote:
> >>>>> "Jim" == Jim Paris <jim@xxxxxxxx> writes:
> 
>     >> From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> Date: Sat,
>     >> 25 Sep 2010 17:01:09 +0200 Subject: Fix formatting warnings
>     Jim> ...
>     >> - fprintf(stderr, "Skip %7d blocks from 0x%08x to 0x%08x at blocks
>     >> %10ld \n", + fprintf(stderr, "Skip %7d blocks from 0x%08x to 0x%08x
>     >> at blocks %10lld \n",
> 
>     Jim> Both of those can give warnings depending on architecture:
> 
>     Jim> #include <stdint.h> #include <stdio.h> #include <inttypes.h> int
>     Jim> main() { uint64_t x = 0x0123456789abcdefULL; printf("%lu\n", x); //
>     Jim> warns on 32-bit arch printf("%llu\n", x); // warns on 64-bit arch
>     Jim> printf("%llu\n", (unsigned long long)x); // correct on both
>     Jim> printf("%" PRIu64 "\n", x); // correct on both return 0; }
> 
> Any idea how to code architecture indepent?

Yeah, use one of the ones I labelled "correct on both"

-jim

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread