Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ucla-cs!zen!ucbvax!decvax!ima!haddock!karl From: karl@haddock.UUCP (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: using varargs function to call another varargs function Message-ID: <685@haddock.UUCP> Date: Mon, 6-Jul-87 17:36:27 EDT Article-I.D.: haddock.685 Posted: Mon Jul 6 17:36:27 1987 Date-Received: Wed, 8-Jul-87 01:01:57 EDT References: <1332@rosevax.Rosemount.COM> <6048@brl-smoke.ARPA> Reply-To: karl@haddock.ISC.COM (Karl Heuer) Distribution: world Organization: Interactive Systems, Boston Lines: 16 Summary: syntactic balancing not needed In article <6048@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn) writes: >[example implementation of printf() using varargs] >... Also, be very careful to balance va_start() with va_end(); these macros >may have { and } respectively embedded in them, which affects their proper >use in more complex situations. I believe Andrew Koenig, the author of varargs, has stated that such implementations are incorrect; code such as va_start(ap); if (...) { ... va_end(ap); ... } else { ... va_end(ap); ... } is perfectly valid. Is this impossible to do right with some compilers? Note that ANSI's, which replaces varargs, does not mention a constraint of "syntactic balancing". Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint