From owner-freebsd-questions@FreeBSD.ORG Sun May 4 15:34:31 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7258106566C for ; Sun, 4 May 2008 15:34:31 +0000 (UTC) (envelope-from unga888@yahoo.com) Received: from web57011.mail.re3.yahoo.com (web57011.mail.re3.yahoo.com [66.196.97.115]) by mx1.freebsd.org (Postfix) with SMTP id 7D3E08FC0A for ; Sun, 4 May 2008 15:34:31 +0000 (UTC) (envelope-from unga888@yahoo.com) Received: (qmail 72074 invoked by uid 60001); 4 May 2008 15:34:30 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=Itq0OZG+48RPEvEWshav3F3NMMAdnOU+Lpyldf9MiMOjfHDsudPv5n2Z2VCpgCzsQ83L0oBNtL9ENR48CvSIrxw3M7ZeHLOFVC297LcgLVC7rLqj0aiFO+4vDOiGYarmkqlkOluoivtNN0Bop2nyGJM3srxFeyjPhICOyJHzHR4=; X-YMail-OSG: amd4p4IVM1kAEamuJ6zBC_yC.eiHduBJ3FvOqm0Bq.iXhzgCYuqZgeQfY3.Jk62nLNyUnBnyTLH64CbNzpgOCYJE_SBlemZ.lGZ.b9SE1eVPB03qt4I8JXB1ikw- Received: from [165.21.155.111] by web57011.mail.re3.yahoo.com via HTTP; Sun, 04 May 2008 08:34:30 PDT Date: Sun, 4 May 2008 08:34:30 -0700 (PDT) From: Unga To: Roland Smith In-Reply-To: <20080504144532.GA56965@slackbox.xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <630200.71551.qm@web57011.mail.re3.yahoo.com> Cc: Patrick Clochesy , freebsd-questions@freebsd.org Subject: Re: Variable arg function question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 May 2008 15:34:31 -0000 --- Roland Smith wrote: > On Sun, May 04, 2008 at 07:02:36AM -0700, Patrick > Clochesy wrote: > > What about using a macro (...) in front of the > function to csll it which > > passes __VARARGS__, NULL to ensure there is always > a trailing NULL? I think > > this would at least work in GCC... Can' test on my > phone though. > > That's a good idea. If one uses __VA_ARGS__ instead > of __VARARGS__, it > should work with any C99 compliant compiler, > including gcc. > > The good thing about variadic macros in C99[1] is > that you don't need a > first argument. > > Roland > > [1: http://en.wikipedia.org/wiki/Variadic_macro] > -- I gave it a try, but I cannot get it to work: (As per above wikipedia example) void realdprintf (char const *file, int line, char const *fmt, ...); #define dprintf(...) realdprintf(__FILE__, __LINE__, __VA_ARGS__) To solve my problem, I must be able to indicate the end of the arg list, may be by a empty string (""), but GNU C compiler does not allow to specify anything after the ... . How do I specify end of arg list? or is that the way? Unga ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ