W? (Add Watch Expression)

Syntax

W? expression[[,format]]

Parameters

expression

Expression to add to the Watch window.

format

A CodeView format specifier that indicates the format in which expression is displayed.

Description

The Add Watch Expression (W?) command displays one or more specified values in the Watch window. Watch expressions allow you to watch how a variable changes as your program executes. CodeView updates the Watch window each time the value of the watch expression changes during program execution.

The Watch window shows variables in the default format for their types. To display a watch expression in a different format, type a comma after the expression, followed by a CodeView format specifier. You can also cast the expression to the format you want to use.

CodeView always evaluates watch expressions according to the current radix and reevalutes watch expressions if the radix changes.

For relational expressions, the Watch window shows 0 if the expression is false and 1 if the expression is true.

Mouse and Keyboard

As an alternative to typing the W? command, choose the Add Watch command from the Data menu. There is no keyboard shortcut.

Examples

Command Action

W? n Display the value of the variable n in the Watch window.
W? high * 100 Display the value of 100 times the variable high in the Watch window.
W? (char *) 0 Display the byte at DS:0. Because 0 is explicitly cast to a pointer type, CodeView treats it as an offset rather than a constant.