C Compiler bug (and fix for a different one)

Andrew Koenig ark at alice.UucP
Wed Jul 30 00:22:10 AEST 1986


> If I'm not throwing them away, what is it you think I'm doing with them?

> Also, the proposed ANSI draft explicitly states that the second and third
> operands of ?: may each have (void) type, so I'm not trying anything
> unusual here.

I think you're using them to form another value.  It is irrelevant
that you're then throwing that value away.  Suppose f() is void
and you say:

	f()+1;

Now you're adding 1 to a void and throwing the result away.  Should that
be permitted?

More seriously, I can actually see both sides of the argument.  But the
construction ...?f():g()  where f() and g() are void is close enough
to the edge that I wouldn't want to use it in any context where I might
ultimately want to run it on a lot of compilers.  Why not just say

	if (...) f(); else g();

??



More information about the Comp.lang.c mailing list