Date: Sun, 02 Nov 2014 18:00:19 +0000 From: "Poul-Henning Kamp" <phk@phk.freebsd.dk> To: Tim Kientzle <tim@kientzle.com> Cc: Freebsd hackers list <freebsd-hackers@freebsd.org>, Paul Koch <paul.koch@akips.com> Subject: Re: how to kernel printf a int64_t? Message-ID: <7917.1414951219@critter.freebsd.dk> In-Reply-To: <3E8C7E0D-5858-4BFF-8C09-FAA68200B988@kientzle.com> References: <439339249.2551223.1414702876172.JavaMail.root@uoguelph.ca> <97A82163-E78D-457E-B649-B243B41A6C6F@kientzle.com> <54558778.7050500@freebsd.org> <20141102114614.38aa9034@akips.com> <3E8C7E0D-5858-4BFF-8C09-FAA68200B988@kientzle.com>
next in thread | previous in thread | raw e-mail | index | archive | help
-------- >> 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. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7917.1414951219>