From: Stefan Sperling Subject: Re: inttypes.h? To: "Todd C. Miller" Cc: Christian Weisgerber , gameoftrees@openbsd.org Date: Sat, 26 Sep 2020 20:49:03 +0200 On Sat, Sep 26, 2020 at 09:51:38AM -0600, Todd C. Miller wrote: > On Sat, 26 Sep 2020 17:41:58 +0200, Christian Weisgerber wrote: > > > The diff below > > > > * ... casts time_t and off_t values to long long, so they are > > guaranteed to match the %lld format specifier. On OpenBSD that > > happens to be the case, on FreeBSD it's a mess that varies by > > architecture. I don't know if that's acceptable, but I see similar > > casts in ssh. > > (Style? Second change in got_object_commit_create() below.) > > I think this is about the best you can do. One alternative is to > cast to intmax_t instead of long long, though I don't think it > really matters. > > > * ... switches the number in parse.y from int64_t to long long, > > since it is assigned to from strtonum(), passed to parseport()'s > > long long parameter, and printed with %lld anyway. > > That makes sense to me and argues for using long long above. I agree. This isn't a burden at all. We'll just need to try to keep these explicit casts in mind when handling time_t and off_t. Since the patch is consistently adding such casts in all relevant places now, this should be easy to keep in mind going forward.