[net.lang.c] return exp

cottrell@nbs-vms.ARPA (02/25/85)

/*
Kevin Szabo responds...
> In article <8048@brl-tgr.ARPA> cottrell@nbs-vms.ARPA writes:
> >	if (exp)			if (exp) {
> >		return exp;			exp;
> >						return;
> >					}
> >
> >The example on the left avoids the braces while semi-documenting
> >the fact that. I know, you are shocked! I'm just a bad guy.
> 
> Sir, you are a sinner. I hope I never have to look at your code. ( 1/2 :-) )
> The code on the left tells me that you are trying to pass back
> a value to the calling routine, and I would be confused as to why
> the calling routine chose to ignore it. If you insert a comment
> to document the fact you are doing something odd, why not just do
> it right the first time and avoid the comment? Of course you may
> not put in any comments, but I amazed that you can figure out what
> your code does three months after you wrote it. 
> 
> You really should be coding in B, or assembler.
> 

"I stab at you from hell's heart" -- The Wrath of Khan

Okay, I guess this is my convention. I am NOT returning a value; when I
DO return a value, I do return(exp), with parens. One thing I didn't say
is that I #define VOID int to flag the misuse (This was before my
compiler supported void). What I'm really against is the idea that I
can say `if (exp) exp, exp;', but not `if (exp) exp, return;'. Since
return is a `statement' I have to do `if (exp) {exp; return;}'. This
is stupid. In fact, the `one statement' philosophy is stupid. An
explicit `endif' ala cpp would be nicer, and else's would always
match the right if. One must know the rules before breaking them. I do.
Actually, my code is quite readable. Wanna try?

	jim
*/

henry@utzoo.UUCP (Henry Spencer) (03/01/85)

> Actually, my code is quite readable. Wanna try?

Honestly, no.  And I especially don't want to have to modify it,
since the way you write it is so radically different from the way
everyone else writes C.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry