From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 5 18:37:14 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9414E106564A for ; Sun, 5 Jun 2011 18:37:14 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 531028FC13 for ; Sun, 5 Jun 2011 18:37:13 +0000 (UTC) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id 1A6375D83; Sun, 5 Jun 2011 18:21:25 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.4/8.14.4) with ESMTP id p55ILOCY011706; Sun, 5 Jun 2011 18:21:24 GMT (envelope-from phk@critter.freebsd.dk) To: Ben Laurie From: "Poul-Henning Kamp" In-Reply-To: Your message of "Sun, 05 Jun 2011 19:13:21 +0100." <4DEBC741.1020200@links.org> Content-Type: text/plain; charset=ISO-8859-1 Date: Sun, 05 Jun 2011 18:21:24 +0000 Message-ID: <11705.1307298084@critter.freebsd.dk> Sender: phk@critter.freebsd.dk X-Mailman-Approved-At: Sun, 05 Jun 2011 19:37:14 +0000 Cc: hackers@freebsd.org Subject: Re: int64_t and printf X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jun 2011 18:37:14 -0000 In message <4DEBC741.1020200@links.org>, Ben Laurie writes: >So, for example int64_t has no printf modifier I am aware of. Likewise >its many friends. >but I have no idea where to put such a thing in FreeBSD. Opinions? I have totally given up on this mess. At best you get incredibly messy source code, at worst you waste a lot of time figuring out why who to define stuff to make some platform you have only heard rumours about behave. I have therefore resorted to printf'ing any typedefed integer type using "%jd" and an explicit cast to (intmax_t): printf("%-30s -> %jd -> %s\n", s, (intmax_t)t, buf); If some system introduces int512_t that may not be optimal, but since printf is a pretty slow operation anyway, I doubt it will hurt even half as much as the alternative. -- 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.