Re: [PATCH 1/2] Improvate portability: Display pid_t's always as long

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

 



David Soria Parra <sn_@xxxxxxx> writes:

> Some systems (like e.g. OpenSolaris) define pid_t as long,
> therefore all our sprintf that use %i cause a compiler warning
> beacuse if the implicit long->int cast. So to make sure that
> we fit the limits we display pids as longs and cast them explicitly.

This patch just makes one wonder what needs to happen when the next random
platform has pid_t as long long or int32_t or whatever signed integral
type that was picked arbitrarily by the platform.

I think these *printf()s are mostly for informational purposes and if you
favor minimum change, you might be better off casting it to "int" without
changing the format specifiers.

On the other hand, if you are shooting for maximum compatibility perhaps
you may want to cast it to "intmax_t" and format as such.

Casting to "long" does not make much sense from either perspective, does
it?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux