Review and Fix Incorrect Object Oriented Programming Checks
This topic describes how to systematically review the results of an Incorrect object oriented programming check in Polyspace® Code Prover™.
Follow one or more of these steps until you determine a fix for the Incorrect object
oriented programming check. For a description of the check and code
examples, see Incorrect object oriented programming
.
For the general workflow that applies to all checks, see Interpret Code Prover Results in Polyspace Desktop User Interface or Interpret Code Prover Results in Polyspace Access Web Interface (Polyspace Access).
Step 1: Interpret Check Information
On the Results List pane, select the check. The Result Details pane displays further information about the check.
You can see:
The immediate cause of the check. For instance:
You dereference a function pointer that has the value
NULL
or points to an invalid member function.The member function is invalid if its argument or return type does not match the pointer argument or return type.
You call a pure
virtual
member function of a class from the class constructor or destructor.You call a member function using an incorrect
this
pointer.To see why the
this
pointer can be incorrect, seeIncorrect object oriented programming
.
The probable root cause of the check, if indicated.
Step 2: Determine Root Cause of Check
If you cannot determine the root cause based on the check information, use navigation shortcuts in the user interface to navigate to the root cause.
Based on the specific error, use one of the following methods to find the root cause.
Error | How to Find Root Cause |
---|---|
You dereference a function pointer that has the value NULL . | Right-click the function pointer and select Search
For All References. Find the instance where you assign |
You dereference a function pointer that points to an invalid member function. | Compare the argument and return types of the function pointer and the member function that it points to.
|
You call a pure virtual member function
from a constructor or destructor. | Find the member function declaration and determine whether
you intended to declare it as
|
You call a member function using an incorrect this pointer. | Determine why the For instance, if a red Incorrect
object oriented programming check appears on a function
call
If a red Incorrect object oriented
programming check appears on a function call |