`safe' putc (was avoiding stdio)
Andrew Koenig
ark at alice.UUCP
Wed Feb 7 15:29:02 AEST 1990
In article <7172 at arcturus>, evil at arcturus.UUCP (Wade Guthrie) writes:
>
> chris at mimsy.umd.edu (Chris Torek) writes:
> > putc *is* *documented* as not being careful about its second parameter.
>
> ark at 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 at europa.att.com
More information about the Comp.lang.c
mailing list