On Wed, Jan 16, 2013 at 7:39 PM, Jordan Rose <[email protected]> wrote:

>
> On Jan 16, 2013, at 2:06 , Chandler Carruth <[email protected]> wrote:
>
> On Mon, Jan 14, 2013 at 8:44 AM, Nico Weber <[email protected]> wrote:
>
>> On Mon, Jan 14, 2013 at 8:24 AM, Daniel Jasper <[email protected]>
>> wrote:
>> > Author: djasper
>> > Date: Mon Jan 14 10:24:39 2013
>> > New Revision: 172431
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=172431&view=rev
>> > Log:
>> > Make single-line if statements optional.
>>
>> Thanks!
>>
>> Out of curiosity, do you know how common this style is in Google's
>> internal code? I haven't seen it much.
>>
>
> For what it's worth, despite having written a lot of single-line if
> statements, I don't think this is worth options in the formatter. I think
> consistency and simplicity should trump here, and since there trivially
> exist cases that can't be on a single line, it seems of very low value to
> support folding onto a single line....
>
> My two cents, and it applies both to Google's internal coding style, and
> my feelings on LLVM's coding style.
>
>
> This is pure opinion, but I actually prefer single-line if statements if
> the braces are omitted. It makes it clearer to me that you can't add
> anything to the consequent clause.
>
> (I agree that this is not the dominant style in LLVM though, or at least
> not in Clang.)
>
> This may eventually be subsumed by a setting to add braces to
> single-statement if-statement.
>
> Jordan
>
>
> Actually, it should probably be a generalized setting that would apply
across the board to `if`, `else`, `for`, `while` for consistency.

-- Matthieu
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to