From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 5 18:31:29 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 E7EE91065672 for ; Sun, 5 Jun 2011 18:31:29 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f11:66f:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id 929568FC12 for ; Sun, 5 Jun 2011 18:31:29 +0000 (UTC) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f11:66f:1::5]) by mail.farley.org (8.14.5/8.14.5) with ESMTP id p55IVSI3022534; Sun, 5 Jun 2011 14:31:28 -0400 (EDT) (envelope-from scf@FreeBSD.org) Date: Sun, 5 Jun 2011 14:31:27 -0400 (EDT) From: "Sean C. Farley" To: Ben Laurie In-Reply-To: <4DEBC741.1020200@links.org> Message-ID: References: <4DEBC741.1020200@links.org> User-Agent: Alpine 2.02 (BSF 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-1.3 required=4.0 tests=AWL,BAYES_00,SPF_SOFTFAIL autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.farley.org 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:31:30 -0000 On Sun, 5 Jun 2011, Ben Laurie wrote: > So, for example int64_t has no printf modifier I am aware of. Likewise > its many friends. > > In the past I've handled this by having a define somewhere along the > lines of... > > #if > # define INT_64_T_FMT "%ld" > #else > # define INT_64_T_FMT "%lld" > #endif > > but I have no idea where to put such a thing in FreeBSD. Opinions? > Also, I guess I'd really need to do a modifier rather than a format, > for full generality. You need to include inttypes.h, which includes machine/_inttypes.h. This will provide the appropriate macro which in this case is PRId64. Sean -- scf@FreeBSD.org