That's genious IMO. Making sure the amount of opening and closing parantheses is equal is annoying and unnecesary.
It screams "trust me all good with the closing parantheses".
It screams "trust me all good with the closing parantheses".
if ((v1.x()-v2.x())*(v1.x()-v2.x())+(v1.y()-v2.y())*(v1.y())-v2.y())+(v1.z()-v2.z())*(v1.z()-v2.z()) > distance*distance) {
// collision
}
Would you like this to fail to compile? Or would you prefer it to silently return the wrong value?where you have defined an actually readable equivalent inside of collisioncheck would be my prerogative... I also agree paren matching failures should error, but your example is NOT why.
On the other hand, auto closing parentheses in code is a terrible idea for obvious reasons. There are only like 7 languages used in industry and they all have excellent tooling that integrates with your editor to eliminate issues like this.