On Fri, Oct 23, 2009 at 01:47:04AM +0200, Alexander Graf wrote: > > On 23.10.2009, at 00:42, Anthony Liguori wrote: > >> Aurelien Jarno wrote: >>> Hi all, >>> >>> I am currently reviewing the S390 patches which extensively use of >>> code like: >>> >>> if (a == 5) printf("a was 5.\n"); >>> else if (a == 6) printf("a was 6.\n"); >>> else printf("a was something else entirely.\n"); >>> >>> It is something currently allowed by the CODING_STYLE document >>> (there is >>> no "indented statement"), but I am not fully comfortable with it. >>> Should >>> we accept such code? Should we fix CODING_STYLE? >>> >> >> I'd vote for fixing CODING_STYLE as that syntax makes my eyes hurt. >> >> While CODING_STYLE is there as a guideline, good taste should still >> always prevail :-) > > I think Uli only wrote the code as is because CODING_STYLE told him to > always use braces around one-liner statements. I don't see how > > if (a == 5) > printf("a was 5.\n"); > else if (a == 6) > printf("a was 6.\n"); > else > printf("a was something else entirely.\n"); > > would be not readable. In fact I tend to use that code style myself a > lot in places where it makes sense like: > > if (r < 0) > return r; > > It would really hurt my eyes to have braces on these simple ifs every > single time. >
It has been debated already a few times already, the argument against this it that it make patches more difficulty readable. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net