Parenthesis around if/for/while condition is not necessary

Basile B. b2.temp at gmx.com
Thu Jul 5 10:01:30 UTC 2018


On Thursday, 5 July 2018 at 09:45:44 UTC, Basile B. wrote:
> On Wednesday, 4 July 2018 at 14:37:49 UTC, Timon Gehr wrote:
>> On 24.06.2018 13:27, Basile B. wrote:
>>> 
>>> FYI this works fine, as expected it's just some small parser 
>>> changes.
>>> I didn't touch to for and foreach for now. I think that 
>>> SwitchStatement is a candidate too.
>>> 
>>> https://github.com/BBasile/dmd/commit/5455a65c8fdee5a6d198782d1f168906b59e6d3d
>>
>> if (a+b)*c == d { ... }
>
> right, maybe logic to apply here is : if the expression parses 
> and no closing paren is found then it's not nececessary.

Actually with the change the example doesn't parse and without it 
didn't either.
The program meaning is not altered so it's fine.


More information about the Digitalmars-d mailing list