Mark Kettenis <mark.kette...@xs4all.nl> wrote: > > Date: Mon, 18 Feb 2019 21:59:38 +0100 > > From: Claudio Jeker <cje...@diehard.n-r-g.com> > > > > In some places bgpd just wants something bigger then a 32bit int. > > Instead of using int64_t or u_int64_t use (unsigned) long long which is at > > least 64bit and therefor good enough. Makes the mess with type definition > > of int64_t on various systems go away (including a bunch of type casts). > > While there also apply the endian.h cleanup done in bgpd a few days ago. > > > > OK? > > You could use <stdint.h> and uint64_t instead. That should be > portable. But you'd still need to be careful about printf statements > since (u)int64_t might be (unsigned) long on some systems.
Indeed, that is the problem, the difference between systems where the 64-bit types are "long" vs "long long". They are both valid, but there is a conflict. That requires casts to the raw-type in some places, but not others. It can be confusing, and as a result people have a tendency to (cautiously) overcast. But casting when you shouldn't can be dangerous. Especially downsize casts.