wald (10/22/82)
Taking head in hands I disagree with a C style rule that I see widely
recommended and used. Please hold the axes!
I prefer having the closing } of a block indented with the block, of
which I consider it logically a part. I.e
if ( ... ) {
...
...
}
rather than
if ( ... ) {
...
...
}
I think it reads easier, especially if there are lots of levels. However,
I will probably soon go with the majority cause I can definitely see the
desirability of having all C code look sort of alike (hear that all you
who put NO comments in your code).
However, I'd like to know if this is an external aesthetic value being
accepted (imposed?) on me or whether a "task force" or other unwieldy group
decided it was "for the best".
bob waldstein
mhuxt!waldjohn (10/22/82)
Actually, I find that the following is an extremely easy style to read
(especially in large programs with lots of levels)
if ( ... )
{
...
...
}
Is there some reason why the other form is a "standard"?doehring (10/27/82)
I don't agree with having the '{' on a separate line when you have
lots of blocks, this is mainly because here at Yale, we have FANTASTIC
screen editors on both our DEC-20s and our VAXEN, Z for the former and
WIN on the later ( Win will also run on VMS systems ).
Both of these editors have a nice little feature called paren balance
which will find the open (,{, or [ which is matched to your present
cursor postion and move the cursor to that character. If it matches
one which is not on the current screen, it will show the matching LINE
on the bottom of the screen and when I see
{
it really tells me nothing, while
if ( ave < total ) {
tells me EXACTLY what I matched.
Also, I like the look of the above code more than having an extra
line following the control statement, but it is up to the individual
as long as it is READABLE.
Martin S. Doehring, '83
decvax!yale-comix!doehring
P.S.- I also like to have the close brace even with the code it is
closing, rather than the control statement, it makes
if / else statements easier to understand.
e
Oh, well, I guess the editor escape didn't work.....perry (11/03/82)
<flame on> My how important we must all feel! After all, twenty different letters exclaiming how THEIR if statement indentation style is superior! Dont you think we have all seen enough of this topic? Next, we'll have seventy notes explaining how their way of indexing through an array is the greatest thing since sliced bread. I am sorry to be a flamer but enough is enough. For those people just discovering the difference between & and &&, reach around and give yourself a very private and quiet pat on the back. Apologies again. (I'm usually not so crabby) <flame off>
aps (11/15/82)
Genrado!johnl,
I also like the format
if (I_HAD_MONEY)
{
...;
}
and have used it since I first learned C.
$.02
aps.