Next: extern data, Previous: enum, Up: Types and Expressions [Contents][Index]
subintThe integer type is available in Dezyne in a restricted way14: only a finite contiguous subrange
of integer numbers can be used. An explicit type definition is needed
for each subset, where a C-like syntax is used.
subint ::= "subint" identifier "{" range "}" ";"
range ::= integer ".." integer
integer ::= ("-")? [0-9]+
An example:
subint int {-1..2};
where subint is a keyword. This defines the finite type
int with possible values -1, 0, 1, and 2. Available integer
operators are:
comparisoni1i1 <= i2i1 >= i2i1 > i2i1 == i2i1 != i2i1 + i2,Integer addition,
i1 - i2Integer subtraction,
where i1 and i2 denote integers.
note: Integers of different
subinttypes can be used in comparison, assignment, and function calls. The verifier will check that the resulting integer value is within the definedsubintrange.
the subint definition allows range checking and prevents accidental unboundedness during model checking