Keil Logo

Expression Classes

Expressions are assigned classes based on the operands that are used. The following classes apply to expressions:

Expression Class Description
N NUMB A classless number.
C ADDR A CODE address symbol.
D ADDR A DATA address symbol.
I ADDR An IDATA address symbol.
X ADDR An XDATA address symbol.
B ADDR A BIT address symbol.

Typically, expressions are assigned the class NUMBER because they are composed only of numeric operands. You may assign a class to an expression using a class operand. An address symbol value is automatically assigned the class of the segment where it is defined. When a value has a class, a few rules apply to how expressions are formed:

  1. The result of a unary operation has the same class as its operand.
  2. The result of all binary operations except + and – will be a NUMBER type.
  3. If only one of the operands of an addition or subtraction operation has a class, the result will have that class. If both operands have a class, the result will be a NUMBER.

This means that a class value (i.e. an addresses symbol) plus or minus a number (or a number plus a class value) give a value with class.

data_address + 10                               gives a data_address value
10 + edata_address                              gives an edata_address value
(data_address - data_address)                   gives a classless number
code_address + (data_address - data_address)    gives a code_address value

Expressions that have a type of NUMBER can be used virtually anywhere. Expressions that have a class can only be used where a class of that type is valid.

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.