PointerNullConstant

A pointer that refers to nothing.

Declaration

Syntax

PointerNullConstant(ttype type, expr? var_expr)

Arguments

Argument

Description

type

the pointer type of the result.

var_expr

the pointer whose type the result takes, when null() was written with an argument; nil otherwise.

Return values

The value of the expression.

Description

null(). It is used as the right hand side of a pointer assignment and as the initialiser of a pointer component, so that a pointer starts out disassociated rather than undefined.

Examples

(PointerNullConstant
  :type (Pointer
    :type (Integer
      :kind 4
    )
  )
  :var_expr nil
)

It comes from this complete ASR text document:

(TranslationUnit
  :symtab (SymbolTable
    :id 0
    :symbols {
      "main" (Program
        :symtab (SymbolTable
          :id 1
          :symbols {
            "p" (Variable
              :parent_symtab 1
              :name "p"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Pointer
                :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 [
          (Associate
            :target (Var
              :v (SymbolRef 1 "p")
            )
            :value (PointerNullConstant
              :type (Pointer
                :type (Integer
                  :kind 4
                )
              )
              :var_expr nil
            )
          )
        ]
      )
    }
  )
  :items []
)

See Also

Nullify, PointerAssociated, Associate, Pointer