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 10:59:25 -0400
> From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
> Date: Sat, 25 Sep 2010 17:01:09 +0200
> Subject: Fix formatting warnings
...
> -                   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",

Both of those can give warnings depending on architecture:

#include <stdint.h>
#include <stdio.h>
#include <inttypes.h>
int main() {
        uint64_t x = 0x0123456789abcdefULL;
        printf("%lu\n", x);                      // warns on 32-bit arch
        printf("%llu\n", x);                     // warns on 64-bit arch
        printf("%llu\n", (unsigned long long)x); // correct on both
        printf("%" PRIu64 "\n", x);              // correct on both
        return 0;
}

-jim

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

Current Thread