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!

Restrictions on C/C++ Expressions

When you enter a C/C++ expression in a debugger window, these general restrictions apply:

Finally, there are some differences and restrictions specific to C++ expressions. For more information on these special considerations, see C++ Expressions.

Numeric Constants

Debugger expressions can use integer constants in octal, hexadecimal, or decimal format. By default, the debugger expects decimal constants. You can change this to hexadecimal: on the Tools menu, click Options. In the Options dialog box, select the Hexadecimal display check box on the Debug tab.

You can use prefix or suffix symbols to represent numbers in another base. The following table shows the forms you can use.

Syntax Base
digits Decimal or hexadecimal, as selected in the Options dialog box on the Debug tab (decimal by default).
0digits Octal (base 8)
0ndigits Decimal (base 10)
0xdigits Hexadecimal (base 16)
digitsh Hexadecimal (base 16)

If you select hexadecimal display in the Options dialog box, you can enter hexadecimal values without the hexadecimal prefix. In that mode, some hexadecimal values (such as abc) can be interpreted as either values or symbols. The debugger looks for a symbol with the matching name first. To enter a number whose hexadecimal representation is the same as a symbol in the program, you must use the hexadecimal prefix (0xabc, for example).

String Literals

Syntax

"string"

The debugger accepts string expressions in C format. You can use any ANSI C escape sequences within a string. (For example, \" for a double quote within a string.)

A string specified in the debugger is volatile. You cannot rely on its continued existence. This means that you cannot assign a string (such as "hello") to a character pointer variable (such as pChar).

You can, however, change a pointer to refer to a different string in your program.

Symbol Formats

You enter a debugger expression that contains symbols in the same form used in the source code, provided the symbols are in a module compiled with full debug information (/Zi or /ZI). If you enter an expression that contains public symbols (symbols found in libraries or in modules compiled with /Zd or /CO), you must use the decorated name of the symbol (the form found used in the object code).

You can get a listing of all names in their decorated and undecorated forms using the LINK /MAP option.

Name decoration is the mechanism used to enforce type-safe linkage. This means that only the names and references with precisely matching spelling, case, calling convention, and type are linked together.

Names declared with the C calling convention (either implicitly or explicitly using the _cdecl keyword) begin with an underscore ( _ ). For example, the function main can be displayed as _main. Names declared as _fastcall begin with the @ symbol.

For C++, the decorated name encodes the type of the symbol in addition to the calling convention. This form of the name can be long and difficult to read. The name begins with at least one question mark (?). For C++ functions, the decoration includes the function's scope, the types of the function's parameters, and the function's return type.

See Also

C/C++ Expressions in the Debugger