From owner-svn-src-head@FreeBSD.ORG Tue Apr 20 09:39:25 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFB64106564A; Tue, 20 Apr 2010 09:39:25 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 3DCB58FC22; Tue, 20 Apr 2010 09:39:24 +0000 (UTC) Received: from c122-106-144-83.carlnfd1.nsw.optusnet.com.au (c122-106-144-83.carlnfd1.nsw.optusnet.com.au [122.106.144.83]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o3K9dEkg011357 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 Apr 2010 19:39:16 +1000 Date: Tue, 20 Apr 2010 19:39:14 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Luigi Rizzo In-Reply-To: <20100420054227.GA62058@onelab2.iet.unipi.it> Message-ID: <20100420192603.R4920@delplex.bde.org> References: <201004191511.o3JFBjLj036350@svn.freebsd.org> <4BCC7E64.4040200@FreeBSD.org> <4BCCDCC9.2070604@elischer.org> <20100420054227.GA62058@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Luigi Rizzo , src-committers@FreeBSD.org, Robert Noland , svn-src-all@FreeBSD.org, Julian Elischer , svn-src-head@FreeBSD.org Subject: Re: svn commit: r206843 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2010 09:39:25 -0000 On Tue, 20 Apr 2010, Luigi Rizzo wrote: > On Mon, Apr 19, 2010 at 03:44:25PM -0700, Julian Elischer wrote: >> On 4/19/10 9:01 AM, Robert Noland wrote: >>> >>> >>> Luigi Rizzo wrote: >> >> >> [...] >> >>> Index: sbin/ipfw/ipfw2.c >>> =================================================================== >>> --- sbin/ipfw/ipfw2.c (revision 206844) >>> +++ sbin/ipfw/ipfw2.c (working copy) >>> @@ -326,7 +326,7 @@ >>> #ifdef TCC >>> #define U64_FMT "I64" >>> #else >>> -#define U64_FMT "llu" >>> +#define U64_FMT "ju" >>> #endif >>> uint64_t d; Ugh. I started introducing intmax_t about 10 years ago to try to kill long long. But long long is now used much more than 10 years ago :-(. Also, uint64_t should not be used in contexts like this (where hardware requirements don't require any particular size). >> believe there is a posix define for this? >> (though I can't remember it right now). Nothing to do with POSIX. The C99 define for this even less portable than the above (though easier to fake in header files). All of the above basically require C99. > the reason for the above code is that MSVC (actually, the DLL in > Windows -- so the problem exists also for TCC on Windows) does not > support %llu or %ju but only %I64 and that is why i need this ugly > code (to tell the truth i am not even sure that the various libc > for embedded platforms support %ju). All FreeBSD libc's should, since %ju is part of the small part of C99 actually supported by FreeBSD. For a vendor embedded platform, support depends on the vendor having the sam support for C99 as FreeBSD does in this area. %I64 is actually better than the C99 formats, though not as good as %IDWIM where the compiler rewrites the format string, replacing %IDWIM by any C99 or vendor format specifier that will work at runtime (only works for literal format strings). I think %I is in sfio, where this and other design errors in stdio were fixed long before C99 standardized more errors. Don't know if sfio has %IDWIM -- this requires compiler support. Bruce