Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!ll-xn!cit-vax!amdahl!jon From: jon@amdahl.UUCP (Jonathan Leech) Newsgroups: net.lang.c Subject: Re: expr?(void):(void) Message-ID: <3502@amdahl.UUCP> Date: Thu, 31-Jul-86 14:18:38 EDT Article-I.D.: amdahl.3502 Posted: Thu Jul 31 14:18:38 1986 Date-Received: Sat, 2-Aug-86 04:27:44 EDT References: <501@bunny.UUCP> <500@copper.UUCP> <273@watmath.UUCP> <5826@think.COM> Distribution: net Organization: Amdahl Corp, Sunnyvale CA Lines: 23 In article <5826@think.COM>, sam@think.COM (Sam Kendall) writes: > ... > Enough cheap shots. Here is an example of using void in "?:". Suppose > you are writing a stdio-like package, and one function has this > specification: > > void PutC(Stream, char); > > But for efficiency you want to write PutC as a macro. So you define it > like this: > > extern void _WriteBuf(Stream); > #define PutC(s, c) (--(s)->count >= 0 ? (void) (*(s)->bufp++ = (c)) \ > : _WriteBuf(s, c)) I won't argue with the desirability of being able to do this, but I believe your example is poorly chosen. I/O functions can always fail and some indication of this ought to be returned to the user where possible, even though few bother to check usage like this. -- Jon Leech (...seismo!amdahl!jon) UTS Products / Amdahl Corporation __@/