From owner-freebsd-hackers@FreeBSD.ORG Sun Nov 2 18:00:28 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A31B640B for ; Sun, 2 Nov 2014 18:00:28 +0000 (UTC) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 5F537F4D for ; Sun, 2 Nov 2014 18:00:28 +0000 (UTC) Received: from critter.freebsd.dk (unknown [192.168.60.3]) by phk.freebsd.dk (Postfix) with ESMTP id E37A03BD2B; Sun, 2 Nov 2014 18:00:20 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.9/8.14.9) with ESMTP id sA2I0JJP007918; Sun, 2 Nov 2014 18:00:20 GMT (envelope-from phk@phk.freebsd.dk) To: Tim Kientzle Subject: Re: how to kernel printf a int64_t? In-reply-to: <3E8C7E0D-5858-4BFF-8C09-FAA68200B988@kientzle.com> From: "Poul-Henning Kamp" 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> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7916.1414951218.1@critter.freebsd.dk> Date: Sun, 02 Nov 2014 18:00:19 +0000 Message-ID: <7917.1414951219@critter.freebsd.dk> X-Mailman-Approved-At: Sun, 02 Nov 2014 18:02:06 +0000 Cc: Freebsd hackers list , Paul Koch X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Nov 2014 18:00:28 -0000 -------- >> 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.