C Compiler bug (and fix for a different one)

Gregory Smith greg at utcsri.UUCP
Sun Jul 27 18:48:08 AEST 1986


In article <5858 at alice.uUCp> ark at alice.UucP (Andrew Koenig) writes:
>> So, does anyone have a fix for this bug?
>> I'll trade for a fix for a problem with void functions and the ?: operator.
>> 
>> void f3(which)
>> {
>>     extern void f1(),f2();
>>     which?f1():f2();
>> }
>> cc(1) gives an "incompatible types" error.
>
>As it should.  The only thing you're allowed to do with void values
>is throw them away.

But it is being thrown away. In e1?e2:e3, the contexts of e2 and e3 are
inherited from the context of the ?: operator itself. In this case,
that is in a 'for effect' or void context, so f1() and f2() should be
treated as 'thrown away' too.


-- 
"You'll need more than a Tylenol if you don't tell me where my father is!"
						- The Ice Pirates
----------------------------------------------------------------------
Greg Smith     University of Toronto      UUCP: ..utzoo!utcsri!greg



More information about the Comp.lang.c mailing list