Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!alice!mjs
From: mjs@alice.UUCP (M. J. Shannon, Jr.)
Newsgroups: net.lang.c
Subject: Re: Which is better?
Message-ID: <3156@alice.UUCP>
Date: Tue, 11-Dec-84 09:44:43 EST
Article-I.D.: alice.3156
Posted: Tue Dec 11 09:44:43 1984
Date-Received: Wed, 12-Dec-84 04:11:42 EST
References: <13900013@acf4.UUCP>
Organization: AT&T Bell Laboratories, Murray Hill
Lines: 32

The question asked was, `Which generates better code?':
	if (exp)
	{
		stuff;
		goto, continue, break, or return;
	}
	any of the other 3;
or:
	if (exp)
	{
		stuff;
		goto, etc.
	}
	else
	{
		any of the other 3;
	}
The answer should be that it makes no difference, and for the compilers
I have access to, it doesn't if you use the -O flag.  If you don't use
an optimizer, then the 2nd case above might generate a branch to a
branch to implement `one of the other 3'.  However, if the compiler is
sufficiently `smart', then it will recognize that the `else' is
superfluous, and nicely fail to generate the branch to branch.

Thus, the answer is that the first form above will generate no worse
code than the 2nd, but any `reasonable' compiler will generate the same
code for both.
-- 
	Marty Shannon
UUCP:	{alice,research}!mjs
	(rabbit is dead; long live alice!)
Phone:	201-582-3199