Optional braces

Jacob Carlborg doob at me.com
Fri Aug 19 10:07:53 PDT 2011


On 2011-08-19 16:33, kennytm wrote:
> Trass3r<un at known.com>  wrote:
>> Am 19.08.2011, 14:16 Uhr, schrieb Timon Gehr<timon.gehr at gmx.ch>:
>>> I think this makes code harder to read for no obvious benefit.
>>> I don't think this is any better than
>>>
>>> class Foo{
>>>       private int a_;
>>>       int a(){return a_;}
>>>       int a(int a){return a_ = a;}
>>> }
>>
>> +1
>>
>> Optional braces should be limited to statements.
>
> I agree. Besides, a minor problem is that 'if' statements may be mistaken
> as template conditions:
>
>      void f1(T)(T x)   if (isFoo!T) { x ++; }
>      void f2(T)(T x) { if (isFoo!T) { x ++; } }

Oh, never thought of that.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list