Inspect Manual

Using Inspect With C++
Inspect Manual429164-006
9-11
The this Pointer
static int global_var;
void member_func(void);
};
int Example_Class::global_var;
The MATCH SCOPE command may be used to find the names of static data
members. For example:
The this Pointer
When the current scope is a nonstatic member function, local member data items must
be qualified with the “this” pointer. For example:
To display all the variables local to the object that invoked the member function, use
the command:
-PROGRAM-DISPLAY *this
Example_Class =
Example_Class::local_var_1 = 99
Example_Class::local_var_2 = 45
Usage Considerations
The HP C++ translator, Cfront, translates a C++ program into an equivalent C program.
Translation results in some restrictions with debugging C++ programs.
These restrictions are:
“References” are not supported. Cfront implements references as pointers. To
display a reference to an object, use the “*” operator to dereference it. In this
example, “i” is an integer and “r” a reference to “i”:
-PROGRAM-DISPLAY Example_Object
Example_Object =
Example_Class::local_var1 = 99
Example_Class::local_var2 = 45
-PROGRAM-MATCH SCOPE Example_Class::*
Program Procedures:Example_Class::member_func(void)
Program Data:
Example_Class::global_var
-PROGRAM-DISPLAY this->Example_Class::local_var_2
Example_Class.Example_Class::local_var_2 = 45