Disallow using comma operator
- by RiaD
I never use the comma operator.
But sometimes, when I write some recursions, I make a stupid mistake: I forget the function name. That's why the last operand is returned, not the result of a recursion call.
Simplified example:
int binpow(int a,int b){
if(!b)
return 1;
if(b&1)
return a*binpow(a,b-1);
return (a*a,b/2); // comma operator
}
Is it possible get a compilation error instead of incorrect, hard to debug code?