Parenthesis around if/for/while condition is not necessary

Nick Treleaven nick at geany.org
Thu Jul 5 08:46:49 UTC 2018


On Wednesday, 4 July 2018 at 14:37:49 UTC, Timon Gehr wrote:
> if (a+b)*c == d { ... }

Error: found `{` when expecting `;` following statement

Adding the semi-colon, `*c == d;` would likely cause:
Error: `*c == d` has no effect

Also multiplying (a+b) by a pointer is illegal, and c is probably 
a pointer if it can be dereferenced. In theory a UDT could define 
opUnary!"*" and opBinary!"*", is that likely?




More information about the Digitalmars-d mailing list