Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pacbell!att!dptg!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c Subject: Re: `safe' putc (was avoiding stdio) Message-ID: <10455@alice.UUCP> Date: 7 Feb 90 04:29:02 GMT References: <10883@attctc.Dallas.TX.US> <21689@mimsy.umd.edu> <7172@arcturus> Distribution: usa Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 29 In article <7172@arcturus>, evil@arcturus.UUCP (Wade Guthrie) writes: > > chris@mimsy.umd.edu (Chris Torek) writes: > > putc *is* *documented* as not being careful about its second parameter. > > ark@alice.UUCP (Andrew Koenig) writes: > >Has anyone out there actually written a program that depends > >for its correct operation on side effects of the second > >argument of putc? > > Sorry, but what are the side effects of the second argument of putc? Putc takes two arguments: a charcter to write and a FILE* that represents where to write it. The following has an undefined effect: putc(c,*fp++); This one, though, is well-defined: putc(*cp++,f); So my question is: are there any people out there who have ever written programs in which they wanted to take advantage of the second argument of putc needing to be evaluated exactly once? -- --Andrew Koenig ark@europa.att.com