Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 May 2008 16:45:32 +0200
From:      Roland Smith <rsmith@xs4all.nl>
To:        Patrick Clochesy <pcloches@gmail.com>
Cc:        Unga <unga888@yahoo.com>, "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>, Peter Boosten <peter@boosten.org>
Subject:   Re: Variable arg function question
Message-ID:  <20080504144532.GA56965@slackbox.xs4all.nl>
In-Reply-To: <8FF3737F-1292-4A19-8A7D-789D8DD70CBE@gmail.com>
References:  <336540.36159.qm@web57014.mail.re3.yahoo.com> <481DA10B.30903@boosten.org> <8FF3737F-1292-4A19-8A7D-789D8DD70CBE@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Qxx1br4bt0+wmkIi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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=
=20
> passes __VARARGS__, NULL to ensure there is always a trailing NULL? I thi=
nk=20
> 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]
--=20
R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)

--Qxx1br4bt0+wmkIi
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEARECAAYFAkgdzAwACgkQEnfvsMMhpyVeCACgoZJsIPd1rSAWHawZFjyDWkTO
ZdsAoJr4U+57J4rPBvBoov5iqoTWTaYW
=sVlN
-----END PGP SIGNATURE-----

--Qxx1br4bt0+wmkIi--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080504144532.GA56965>