Re:Ifs and &&s and Plan 9's Source Code
by MaulingMonkey on Friday May 24, 2013 @07:04PM
(#5765710)
I'd prefer some variation on:
[ Parent
| on HN ]
I think it's fascinating that we prefer styles that are almost opposites:
int samedirfile(Dir *a, Dir *b) {
if(a == b) {
return 1;
}
return (a && b)
&& (a->qid.type == b->qid.type)
&& (a->qid.path == b->qid.path)
&& (a->qid.vers == b->qid.vers)
&& (a->dev == b->dev)
&& (a->type == b->type);
}
...
if(samedirfile(a, b)) {
fprint(2, "cp: %s and %s are the same file\n", an, bn);
ret = 1;
}
Re:Ifs and &&s and Plan 9's Source Code
by MaulingMonkey on Tuesday May 28, 2013 @01:24AM
(#5778242)
I'll note I actually have a slight preference for prepended continuation operators like you have, but I stick to the style used at work for the sake of my sanity in trying to write consistent code.
Re:Ifs and &&s and Plan 9's Source Code
by drivebyacct2 on Saturday May 25, 2013 @07:44AM
(#5766965)
I'm so, so, so glad that new languages are banning braceless if/else bodies.
Re:Ifs and &&s and Plan 9's Source Code
by MaulingMonkey on Tuesday May 28, 2013 @01:24AM
(#5778243)
So how about that python? </trololololo>
Re:Ifs and &&s and Plan 9's Source Code
by drivebyacct2 on Thursday May 30, 2013 @05:12AM
(#5791572)
I should have of course said "some" :)