Using Programming Language Elements
Using C and C++
This section contains guidelines for using C and C++ in expressions.
You can use C-style (
/* comment */) and C++-style (
// comment) comments; for example:
// This code fragment creates a temporary patch
i = i + 2; /* Add two to i */
You can omit semicolons if the result isn’t ambiguous.
You can use dollar signs ($) in identifiers. However, we recommend that you do not use dollar signs in names created within the expression system.
NOTE: If your program does not use a templated function within a library, your compiler may not include a reference to the function in the symbol table. That is, TotalView does not create template instances. In some cases, you might be able to overcome this limitation by preloading the library. However, this only works with some compilers. Most compilers only generate STL operators if your program uses them.
You can use the following C and C++ data types and declarations:
You can use all standard data types such as
char,
short,
int,
float, and
double, modifiers to these data types such as
long int and
unsigned int, and pointers to any primitive type or any named type in the target program.
You can only use simple declarations. Do not define
stuct,
class,
enum or
union types or variables.
You can define a pointer to any of these data types. If an enum is already defined in your program, you can use that type when defining a variable.
The
extern and
static declarations are not supported.
You can use the following the C and C++ language statements.
You can use the
goto statement to define and branch to symbolic labels. These labels are local to the window. You can also refer to a line number in the program. This line number is the number displayed in the Source Pane. For example, the following
goto statement branches to source line number 432 of the target program:
goto 432;
Although you can use function calls, you can’t pass structures.
You can use type casting.
You can use assignment,
break,
continue,
if/
else structures,
for,
goto, and
while statements. Creating a
goto that branches to another TotalView evaluation is undefined.