From owner-freebsd-questions@FreeBSD.ORG Sun May 4 15:58: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 1281F106564A for ; Sun, 4 May 2008 15:58:31 +0000 (UTC) (envelope-from unga888@yahoo.com) Received: from web57007.mail.re3.yahoo.com (web57007.mail.re3.yahoo.com [66.196.97.111]) by mx1.freebsd.org (Postfix) with SMTP id C8C9A8FC26 for ; Sun, 4 May 2008 15:58:30 +0000 (UTC) (envelope-from unga888@yahoo.com) Received: (qmail 76937 invoked by uid 60001); 4 May 2008 15:58:29 -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=yJxFlfhZwh4mCNdXN2dbAXGR+oVdDwCiGKAUyjMgtT2BqoWY77g0SvDQE8ON6HpsAlSGGZ68fV5OzVfz3MzzKy7TxLbDbWSYjbPFlLO+73YzJL8cLCvfNfquVwNgKYjPXVP9RRbU7cR2Jz0Zm4Sv0YY9LSMvhOuq5w52Y4jEPGU=; X-YMail-OSG: iZHbKBIVM1lsr1wW1TStZ5P176p28HNkbnSvckfhGKyXDf4v92kqhvoIyspVP6xuP_ohKbcAhQtd.FjVRiCFnB2VuJu5tDgcGeArG5aKfrnFUQ_ylxVevmu.OFc- Received: from [165.21.154.72] by web57007.mail.re3.yahoo.com via HTTP; Sun, 04 May 2008 08:58:29 PDT Date: Sun, 4 May 2008 08:58:29 -0700 (PDT) From: Unga To: Roland Smith In-Reply-To: <20080504154734.GA98310@slackbox.xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <861035.74979.qm@web57007.mail.re3.yahoo.com> Cc: Patrick Clochesy , freebsd-questions@freebsd.org Subject: Re: Variable arg function question [SOLVED] 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:58:31 -0000 --- Roland Smith wrote: > On Sun, May 04, 2008 at 08:34:30AM -0700, Unga > wrote: > > > > --- 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. > > > 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 ... . > > Try something like what Patrick suggested: > > #define f(...) _f(__VA_ARGS__,NULL) > Hey, it worked :) Thanks guys for the help. Appreciate it very much. Unga ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ