Which is better?

Guy Harris guy at rlgvax.UUCP
Tue Dec 11 10:27:37 AEST 1984


Both

	if (condition)
	{
		code....
		break;
	}
	other code....
	break;

and

	if (condition)
	{
		code....
	}
	else
	{
		other code.....
	}
	break;

generate identical code with the 4.2BSD VAX PCC when the -O flag is on, which
isn't too surprising since those code sequences are equivalent.  That
probably requires that the compiler be smart enough to recognize jumps to
jumps and the like, but any compiler that does those optimizations should
generate the same code for both.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.lang.c mailing list