Advise on use of int64_t cast

Advise on testing with clang compiler and using int64_t cast with PRIll
macro.

Fix GCC warning when 'make distcheck' is run.
libusb-1-0
Nate Bargmann 2016-02-09 11:26:23 -06:00
rodzic 95a99fa37d
commit cc21c64662
2 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -577,12 +577,13 @@ Hamlib should also compile with the following common compilers:
* gcc-4.x and newer
* in shared and static
* C++ compiler against rig.h, riglist.h, rotator.h
* clang compiler
Portability issues to watch:
* little vs. big endian systems (use shifts or adhoc functions)
* 64 bit int: avoid them in API
* printf/scanf of 64bit int: use PRIll and SCNll
* printf/scanf of 64bit int: use PRIll (cast value to int64_t) and SCNll
* printf/scanf of freq_t: use PRIfreq and SCNfreq
Testing:

Wyświetl plik

@ -40,7 +40,7 @@ int main (int argc, char *argv[])
printf("BCD: %2.2x",b[0]);
for (i = 1; i < (digits+1)/2; i++)
printf(",%2.2x",b[i]);
printf("\nResult after recoding: %"PRIll"\n", from_bcd(b, digits));
printf("\nResult after recoding: %"PRIll"\n", (int64_t)from_bcd(b, digits));
printf("\nBig Endian mode\n");
printf("Frequency: %"PRIfreq"\n",f);
@ -48,7 +48,7 @@ int main (int argc, char *argv[])
printf("BCD: %2.2x",b[0]);
for (i = 1; i < (digits+1)/2; i++)
printf(",%2.2x",b[i]);
printf("\nResult after recoding: %"PRIll"\n", from_bcd_be(b, digits));
printf("\nResult after recoding: %"PRIll"\n", (int64_t)from_bcd_be(b, digits));
return 0;
}