BUG OF THE MONTH | A typo in the condition

V501 There are identical sub-expressions to the left and to the right of the ‘-‘ operator: iA->getPoint2D() – iA->getPoint2D() curve.cpp 136

CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3)
  if ((iA->getPoint2D() -                  
       iA->getPoint2D()).norm() < 1.0e-6) { 

Inside the CurvePoint function the program handles two objects with similar names – iA and iB. Different methods of these objects get intersected all the time in various operations in quite a long tree of conditions. There is a typo in one of these conditional blocks. As a result we have a subtraction operation between the properties of one and the same object. Without knowing the peculiarities of the code, it’s quite hard to say, in which operand we have an error.

Please click here to see more bugs from this project.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.