Adding and Removing Expressions

An expression is a snippet of code that is evaluated to produce a value. In Carbide they are defined using C/C++ expressions. Some expressions may need to be evaluated at a specific location in the program so that its variables can be referenced. Adding more expressions to the Expressions view list can slow down the automatic display as each must be evaluated to update its value. To manage large lists of expressions, use the Enable and Disable options in the context menu to control which expressions are automatically evaluated.

You add expressions in the Add Watch Expression dialog using a variety of views, including Expressions, Variables, and editor views. Right-click in the view and select the Add Watch Expression... command from the context menu.

Figure 1. Add Watch Expression dialog

You can enter any valid C/C++ expression, for example:

2 + 2
myVariable + 8
&myVariable
myClass.myMemberVar
etc.

are all valid expressions that the Expressions view can monitor and display. However, an expression cannot call a function or execute code. The following example will not work:

std:strlen("Hello");

Removing Expressions

Right-click the expression in the Expressions view and select the Remove menu option. This removes the selected expression from the Expression list.

Other references