how to kernel printf a int64_t?
Ian Lepore
ian at FreeBSD.org
Sun Nov 2 18:06:05 UTC 2014
On Sun, 2014-11-02 at 18:00 +0000, Poul-Henning Kamp wrote:
> --------
>
> >> We've always used the PRIxxx types when coding for both 32/64 platforms,
> >> but it would have been really nice to have a standard way for time_t.
> >> Something like PRItt
>
> That road leads to madness, because now both the reader and the writer
> needs to remember what the PRIxx is for inode_t, socklen_t and so on.
>
> In no time you've run out of 'xx' and some camelCaseContrarian will
> start using PRI_inode_t "for readability" and... ARGH!
>
> Casting to [u]intmax_t and using %j is horrible, but not nearly as
> horrible as any other currently available option.
>
> The *right* solution, could only exist if ISO-C had consisted of
> actual C programmers: A varargs definition which transferred both
> argument and it's type, so that printf wouldn't need any size
> integers at all, but could tell by itself.
>
> The resulting increase in code safety and robustness alone would
> make this worth the effort to implement.
>
VAX/VMS pass-by-descriptor comes back to life in the 21st century!
-- Ian
More information about the freebsd-hackers
mailing list