I understand what this C ++ function does, but I don’t understand why the instruction is returnwritten as follows:
int intDivide(int num, int denom){
return assert(denom!=0), num/denom;
}
There is only one statement here, because there is only one ;, but the comma confuses me. Why not write:
int intDivide(int num, int denom){
assert(denom!=0);
return num/denom;
}
Besides “elegance,” is there anything you can get in the first version?
What exactly does a comma do? Does he break one operator into 2 parts, so that essentially the above 2 versions are identical?
source
share