ArrayBound

Array upper and lower bound.

声明

语法

ArrayBound(expr v, expr? dim, ttype type, arraybound bound,
                 expr? value)

参数

Argument Name

Argument Description

v

表达

dim

dimension

type

table entry type

bound

array bound

value

expression value

返回值

The return value is the expression that the ArrayBound represents.

描述

ArrayBound represents bounds of array. It can be upper or lower bound.

类型

Only accepts integers.

示例

integer :: a(2:5, 3:9, 7)
print *, lbound(a, 1), lbound(a, 2), lbound(a, 3)

ASR:

(TranslationUnit
    (SymbolTable
        1
        {
            a:
                (Variable
                    1
                    a
                    Local
                    ()
                    ()
                    Default
                    (Integer 4 [((IntegerConstant 2 (Integer 4 []))
                    (IntegerConstant 4 (Integer 4 [])))
                    ((IntegerConstant 3 (Integer 4 []))
                    (IntegerConstant 7 (Integer 4 [])))
                    ((IntegerConstant 1 (Integer 4 []))
                    (IntegerConstant 7 (Integer 4 [])))])
                    Source
                    Public
                    Required
                    .false.
                )

        })
    [(Print
        ()
        [(ArrayBound
            (Var 1 a)
            (IntegerConstant 1 (Integer 4 []))
            (Integer 4 [])
            LBound
            ()
        )
        (ArrayBound
            (Var 1 a)
            (IntegerConstant 2 (Integer 4 []))
            (Integer 4 [])
            LBound
            ()
        )
        (ArrayBound
            (Var 1 a)
            (IntegerConstant 3 (Integer 4 []))
            (Integer 4 [])
            LBound
            ()
        )]
        ()
        ()
    )]
)

也可以看看