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.

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.

----------------

Is x the result of foo() or bar()?

int foo() { return 10; }
int bar() { return 20; }
void main() {
    int x;
    x = foo(), bar();
}

----------------

The comma could be mistaken for a semicolon:

void main() {
    int x;
    if (x > 0) x = 0,
               x = 1;
}

Bye,
bearophile

Reply via email to