From owner-freebsd-arch@FreeBSD.ORG Thu Feb 5 12:44:18 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D0A4416A4CE for ; Thu, 5 Feb 2004 12:44:18 -0800 (PST) Received: from mail2.speakeasy.net (mail2.speakeasy.net [216.254.0.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id C373143D55 for ; Thu, 5 Feb 2004 12:43:54 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 21325 invoked from network); 5 Feb 2004 20:43:49 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 5 Feb 2004 20:43:49 -0000 Received: from 10.50.40.205 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.10/8.12.10) with ESMTP id i15KhiM0014557; Thu, 5 Feb 2004 15:43:44 -0500 (EST) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Stefan Farfeleder Date: Thu, 5 Feb 2004 15:44:48 -0500 User-Agent: KMail/1.5.4 References: <20040205164639.GC602@wombat.fafoe.narf.at> <200402051405.59533.john@baldwin.cx> <20040205200454.GD602@wombat.fafoe.narf.at> In-Reply-To: <20040205200454.GD602@wombat.fafoe.narf.at> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200402051544.48349.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: arch@freebsd.org Subject: Re: C99 variadic macros X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Feb 2004 20:44:19 -0000 On Thursday 05 February 2004 03:04 pm, Stefan Farfeleder wrote: > On Thu, Feb 05, 2004 at 02:05:59PM -0500, John Baldwin wrote: > > On Thursday 05 February 2004 11:46 am, Stefan Farfeleder wrote: > > > #define foo(fmt, args...) printf("%s: " fmt "\n", __func__, ##args) > > > > C99 macros don't work when args is 0. I.e., if I did: > > > > foo("test"); > > > > The C99 _VA_ARGS_ think doesn't delete the , whereas the GCC way does. > > While it's true that the ellipsis must match a positive number of > arguments, this isn't necessarily a problem. You just use "..." for > both the format string and its arguments. Not always easily done in my experience, though the 3 printf thing (ugh) might serve as a workaround as I didn't try that before when I've tried to use the C99 way. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org