<br><div class="gmail_quote">On Fri, Dec 31, 2010 at 2:09 AM, bearophile <span dir="ltr"><<a href="mailto:bearophileHUGS@lycos.com">bearophileHUGS@lycos.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I'd like to restrict a bit the usage of the comma operator in D2, disallowing at compile-time some currently usages that some C style guides already suggest to avoid.<br>
<br>
If I see production code like the two examples below in production code, I change the code, and remove the commas. I think they are confusing, and may hide bugs. Do you know other situations where you like to disallow the comma operator in D2? Later I will probably write an enhancement request on this.<br>

<br>
----------------<br>
<br>
Is x the result of foo() or bar()?<br>
<br>
int foo() { return 10; }<br>
int bar() { return 20; }<br>
void main() {<br>
    int x;<br>
    x = foo(), bar();<br>
}<br>
<br>
----------------<br>
<br>
The comma could be mistaken for a semicolon:<br>
<br>
void main() {<br>
    int x;<br>
    if (x > 0) x = 0,<br>
               x = 1;<br>
}<br>
<br>
Bye,<br>
<font color="#888888">bearophile<br>
</font></blockquote></div><br>What font are you using?<br>