gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

long long unsigned on 32-bit machines


From: Sanjeev Gupta
Subject: long long unsigned on 32-bit machines
Date: Sun, 26 Jan 2020 14:40:25 +0800

In commit a440745838e3252f0e646f2e154badf58e344ed4
Bernd changed:

-       unsigned long i;         // unsigned long just in case ints are 32-bit
+       uint64_t i;         // uint64_t just in case ints are 32-bit


This creates warning on 32-bit machines:

    monitor_italk.c: In function 'display_itk_navfix':
    monitor_italk.c:167:29: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=]
      167 |   (void)snprintf(prn, 4, "%lu ", i + 1);
          |                           ~~^    ~~~~~
          |                             |      |
          |                             |      uint64_t {aka long long unsigned int}
          |                             long unsigned int
          |                           %llu


If I change the format to %llu , the build on 32-bit works, but then, on a 64-bit:

monitor_italk.c:167:30: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'uint64_t' {aka 'long unsigned int'} [-Wformat=]
  167 |   (void)snprintf(prn, 4, "%llu ", i + 1);
      |                           ~~~^    ~~~~~
      |                              |      |
      |                              |      uint64_t {aka long unsigned int}
      |                              long long unsigned int
      |                           %lu



I think the issue is that we are mixing up two ways, the "long unsigned", and the specific types.

BTW, is anyone else running on 32-bits, in production?


--
Sanjeev Gupta
+65 98551208     http://www.linkedin.com/in/ghane

reply via email to

[Prev in Thread] Current Thread [Next in Thread]