Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mcvax!mhres!jv From: jv@mhres.mh.nl (Johan Vromans) Newsgroups: comp.lang.c Subject: Re: sprintf value (was: goto's and switch statements -- mild proposal) Message-ID: <1282@mhres.mh.nl> Date: Sun, 6-Sep-87 06:18:20 EDT Article-I.D.: mhres.1282 Posted: Sun Sep 6 06:18:20 1987 Date-Received: Sun, 6-Sep-87 20:59:43 EDT References: <855@tjalk.cs.vu.nl> <2683@hoptoad.uucp> <916@haddock.ISC.COM> <732@spar.SPAR.SLB.COM> <8413@mimsy.UUCP> Organization: Multihouse N.V., The Netherlands Lines: 31 >>What about all my code where I do something like: >> >> f = fopen(sprintf(buf, filename, seq_num++), ...); > >It has to become > > (void) sprintf(buf, filename, seq_num++); > f = fopen(buf, ...); > >>This seems like a gratuitous change to me ! > How about using the alternation operator (,) : f = fopen (((void) sprintf(buf, filename, seq_num++), buf), ...); For clarity, I would use a define like #define NEXTNAME(name,seq) ((void) sprintf(buf, name, seq++), buf) -- I have lots of programs which use statements like used += sprintf (buf+used, ....) One of us has to make changes.... -- -- Johan Vromans | jv@mh.nl via European backbone Multihouse N.V., Gouda, the Netherlands | uucp: ..{?????!}mcvax!mh.nl!jv "It is better to light a candle than to curse the darkness"