From owner-freebsd-arch@FreeBSD.ORG Thu Feb 5 12:06:13 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 58AA816A4CE for ; Thu, 5 Feb 2004 12:06:13 -0800 (PST) Received: from laika.ifs.tuwien.ac.at (laika.ifs.tuwien.ac.at [128.131.167.43]) by mx1.FreeBSD.org (Postfix) with ESMTP id 37C0043D68 for ; Thu, 5 Feb 2004 12:05:49 -0800 (PST) (envelope-from stefan@fafoe.narf.at) Received: from fafoe.narf.at (unknown [212.186.3.235]) by laika.ifs.tuwien.ac.at (Postfix) with ESMTP id 509E3209E; Thu, 5 Feb 2004 21:06:49 +0100 (CET) Received: from wombat.fafoe.narf.at (wombat.fafoe.narf.at [192.168.1.42]) by fafoe.narf.at (Postfix) with ESMTP id 1108840ED; Thu, 5 Feb 2004 21:04:57 +0100 (CET) Received: by wombat.fafoe.narf.at (Postfix, from userid 1001) id 845E21D4; Thu, 5 Feb 2004 21:04:56 +0100 (CET) Date: Thu, 5 Feb 2004 21:04:56 +0100 From: Stefan Farfeleder To: John Baldwin Message-ID: <20040205200454.GD602@wombat.fafoe.narf.at> References: <20040205164639.GC602@wombat.fafoe.narf.at> <200402051405.59533.john@baldwin.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200402051405.59533.john@baldwin.cx> User-Agent: Mutt/1.5.5.1i 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:06:15 -0000 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. Cheers, Stefan Farfeleder