return exp
cottrell at nbs-vms.ARPA
cottrell at nbs-vms.ARPA
Tue Feb 26 06:57:19 AEST 1985
/*
Kevin Szabo responds...
> In article <8048 at brl-tgr.ARPA> cottrell at 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
*/
More information about the Comp.lang.c
mailing list