r190962 - get rid of extra parentheses.
Eric Christopher
echristo at gmail.com
Thu Sep 19 10:21:10 PDT 2013
On Thu, Sep 19, 2013 at 10:18 AM, Jordan Rose <jordan_rose at apple.com> wrote:
>
> On Sep 19, 2013, at 9:41 , Eric Christopher <echristo at gmail.com> wrote:
>
>> On Thu, Sep 19, 2013 at 8:31 AM, Adrian Prantl <aprantl at apple.com> wrote:
>>>
>>> On Sep 18, 2013, at 11:29 PM, Tobias Grosser <tobias at grosser.es> wrote:
>>>
>>>> On 09/19/2013 12:18 AM, Adrian Prantl wrote:
>>>>> Author: adrian
>>>>> Date: Wed Sep 18 17:18:17 2013
>>>>> New Revision: 190962
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=190962&view=rev
>>>>> Log:
>>>>> get rid of extra parentheses.
>>>>
>>>> Hi Adrian,
>>>>
>>>> I have the feeling this change is contrary to what people normally do in LLVM. Specifically, either people have parenthesis on all branches or
>>>> we use none at all.
>>>
>>> You might want to discuss this with Eric :-)
>>>
>>
>> Normally I'd point you at the coding style doc which should have this,
>> however, it apparently doesn't. In general for single line statements
>> after a conditional we don't have braces - except where we would need
>> to quiet a dangling else warning. I'm curious where you've seen
>> contrary (except apparently some bad cases in the coding style doc).
>
> I thought the general case used to be in the coding style doc; maybe it was removed a while ago. But I agree with Tobi that it looks asymmetrical when there are braces on one branch but not another.
>
> if (...)
> doSomething(); // perfectly reasonable
>
>
> if (...) {
> // lots
> // of
> // work
> doSomething();
> // lots
> // more
> // work
> } else
> doSomething(false);
>
>
> Personally, I'd much rather have the braces on all branches or none, *then* apply the rule about "prefer no braces". (Which I'm not particularly a fan of, but it is definitely the dominant style.)
>
FWIW I agree, but it definitely hasn't been the style to this point.
-eric
More information about the cfe-commits
mailing list