Displaying C and C++ Data Types
The syntax for displaying data is identical to C and C++ language cast syntax for all data types except pointers to arrays. That is, you use C and C++ cast syntax for data types. For example, you can cast using types such as
int,
char,
unsigned,
float,
double,
union, all named
struct types, and so on. In addition, TotalView has a built-in type called
$string. Unless you tell it otherwise, TotalView maps
char arrays to this type. (For information on wide characters, see
“Viewing Wide Character Arrays ($wchar Data Types)”.)
Read TotalView types from right to left. For example, $string*[20]* is a pointer to an array of 20 pointers to $string.
The following table shows some common TotalView data types:
Data Type String | Description |
int | Integer |
int* | Pointer to an integer |
int[10] | Array of 10 integers |
$string | Null-terminated character string |
$string** | Pointer to a pointer to a null-terminated character string |
$string*[20]* | Pointer to an array of 20 pointers to null-terminated strings |
You can enter C and C++ Language cast syntax in the
Type field.
Figure 140 shows three different ways to cast:
The two Variable Windows cast the same data in the same way. In the top-left window, a cast was used in the Expression field. In the other Variable Window, the data type was changed from int to $char. In the first cast, TotalView changed the Type for you. In the second, it did not alter the Expression field.
The Expression List Window contains two casting examples. The first casts a function’s returned value to long long. The second is the same cast as was made in the two Variable Windows.
TotalView also lets you cast a variable into an array. In the GUI, add an array specifier to the Type declaration. For example, adding [3] to a variable declared as an int changes it into an array of three ints.
When TotalView displays some complex arrays and structures, it displays the compound object or array types in the Variable Window.
NOTE >> Editing a compound object or array data type can produce undesirable results. TotalView tries to give you what you ask for, so if you get it wrong, the results are unpredictable. Fortunately, the remedy is quite simple: close the Variable Window and start over again.
The following sections discuss more complex data types.