NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Additional Operators

Debugger expressions support the following additional operators:

The memory operators are useful mainly in debugging assembly-language code.

The Context Operator

The context operator ({ }) is not part of the C/C++ language. It is specific to the debugger. The context operator specifies the context of an expression or line number that appears in more than one place in the source code.

For example, you can use the context operator to specify a name in an outer scope that is otherwise hidden by a local name.

When a debugger expression that contains a symbol, the expression evaluator searches for the symbol in the following order:

  1. Lexical scope outward. Starting with the current block (series of statements enclosed in curly braces) and continuing outward with the enclosing block. The current block is the code containing the current location (instruction pointer address).
  2. Function scope. The current function.
  3. Class scope, if the current location is inside a C++ member function. Class scope includes all base classes. The expression evaluator uses the normal dominance rules.
  4. Current module.
  5. Global symbols.
  6. Other modules.
  7. Public symbols in the program.

With the context operator, you specify the starting point of the search and bypass the current location. You cannot specify a block because a block has no name. You cannot specify a class, but you can specify a member function of the class and let the expression evaluator search outward.

Syntax

{[function],[file],[image]} [expression]
function
The name of a function in the program.
file
The name of a source file. You must specify a source file if the function is outside the current scope. If the file is not in the current directory, you must specify the path.
expression
The path of a program's DLL or .exe file.
object
A line number or symbol.

The context operator has the same precedence and associativity as the type-cast operator. You can omit function, file, or expression, but you must specify all leading commas. If a name contains a comma, you must enclose the name in parentheses.

Example

Suppose you want to display the value of the variable Pos, which is local to the function make_box defined in the source file DRAWBOX.C. Type the following in the QuickWatch dialog box or the Watch window:

{make_box,C:\TREE1\DRAWBOX.C,C:\TREE2\DISPTXT.DLL}Pos

If there is more than one source file called DRAWBOX.C, the third parameter specifies that the source file containing the function make_box is the one used by DISPTXT.DLL. Otherwise, you can leave out this parameter.

See Also

C/C++ Expressions in the Debugger