gpsd-dev
[Top][All Lists]
Advanced

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

[gpsd-dev] type issues in gpspipe.c


From: Greg Troxel
Subject: [gpsd-dev] type issues in gpspipe.c
Date: Thu, 28 Aug 2014 07:59:41 -0400
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/23.4 (berkeley-unix)

I am seeing warnings when building gpspipe.c.  On NetBSD, time_t is
int64_t, and that's an increasingly likely choice.  suseconds_t is int,
at least on i386.

The right fix is to get the standards bodies to define PRI macros for these 
types :-)

In the real world, we probably need to cast to a guaranteed-big-enough type.

I would suggest int64_t for time_t (although uint64_t might be better,
as I think time_t is not guaranteed to be signed), and either uint64_t
or long int for suseconds_t.  Increasingly I am a fan of uintXX_t for
types that the programmer knows needs a certain range.

gpspipe.c: In function 'main':
gpspipe.c:345:12: warning: format '%ld' expects type 'long int', but argument 4 
has type 'time_t'
gpspipe.c:345:12: warning: format '%06ld' expects type 'long int', but argument 
5 has type 'suseconds_t'
gpspipe.c:345:12: warning: format '%ld' expects type 'long int', but argument 4 
has type 'time_t'
gpspipe.c:345:12: warning: format '%06ld' expects type 'long int', but argument 
5 has type 'suseconds_t'
gpspipe.c:349:12: warning: format '%06ld' expects type 'long int', but argument 
4 has type 'suseconds_t'
gpspipe.c:349:12: warning: format '%06ld' expects type 'long int', but argument 
4 has type 'suseconds_t'
gpspipe.c: In function 'main':
gpspipe.c:345:12: warning: format '%ld' expects type 'long int', but argument 4 
has type 'time_t'
gpspipe.c:345:12: warning: format '%06ld' expects type 'long int', but argument 
5 has type 'suseconds_t'
gpspipe.c:345:12: warning: format '%ld' expects type 'long int', but argument 4 
has type 'time_t'
gpspipe.c:345:12: warning: format '%06ld' expects type 'long int', but argument 
5 has type 'suseconds_t'
gpspipe.c:349:12: warning: format '%06ld' expects type 'long int', but argument 
4 has type 'suseconds_t'
gpspipe.c:349:12: warning: format '%06ld' expects type 'long int', but argument 
4 has type 'suseconds_t'

Attachment: pgpRosnQ6dg04.pgp
Description: PGP signature


reply via email to

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