libftdi Archives

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

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sun, 26 Sep 2010 17:00:54 +0200
>>>>> "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?
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

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

Current Thread