IfArithmetic¶
The obsolescent arithmetic if: a three-way branch on the sign of an expression.
Declaration¶
Syntax¶
IfArithmetic(expr test, int lt_label, int eq_label, int gt_label)
Arguments¶
Argument |
Description |
|---|---|
|
the numeric expression whose sign selects the branch. |
|
the label to jump to when |
|
the label to jump to when |
|
the label to jump to when |
Return values¶
None.
Description¶
if (x) 10, 20, 30 jumps to one of three labels according to the sign of x.
The feature was declared obsolescent in Fortran 90 and is supported for legacy
code.
The three members are label ids, matching the id of a
GoToTarget, exactly like GoTo.
Examples¶
(IfArithmetic
:test (Var
:v (SymbolRef 1 "i")
)
:lt_label 100
:eq_label 100
:gt_label 100
)
It comes from this complete ASR text document:
(TranslationUnit
:symtab (SymbolTable
:id 0
:symbols {
"main" (Program
:symtab (SymbolTable
:id 1
:symbols {
"i" (Variable
:parent_symtab 1
:name "i"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (Integer
:kind 4
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
"label" (Variable
:parent_symtab 1
:name "label"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (Integer
:kind 4
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
}
)
:name "main"
:dependencies []
:body [
(Assign
:label 100
:variable "label"
)
(GoTo
:target_id 100
:name "100"
)
(Assignment
:target (Var
:v (SymbolRef 1 "i")
)
:value (IntegerConstant
:n 1
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:overloaded nil
:realloc_lhs false
:move_allocation false
)
(GoToTarget
:id 100
:name "100"
)
(IfArithmetic
:test (Var
:v (SymbolRef 1 "i")
)
:lt_label 100
:eq_label 100
:gt_label 100
)
]
)
}
)
:items []
)
See Also¶
If, GoTo, GoToTarget