Skip to content

Latest commit

 

History

History
27 lines (15 loc) · 1.36 KB

iii.4.5-initobj.md

File metadata and controls

27 lines (15 loc) · 1.36 KB

III.4.5 initobj – initialize the value at an address

Format Assembly Format Description
FE 15 <T> initobj typeTok Initialize the value at address dest.

Stack Transition:

…, dest → …,

Description:

The initobj instruction initializes an address with a default value. typeTok is a metadata token (a typedef, typeref, or typespec). dest is an unmanaged pointer (native int), or a managed pointer (&). If typeTok is a value type, the initobj instruction initializes each field of dest to null or a zero of the appropriate built-in type. If typeTok is a value type, then after this instruction is executed, the instance is ready for a constructor method to be called. If typeTok is a reference type, the initobj instruction has the same effect as ldnull followed by stind.ref.

Unlike newobj, the initobj instruction does not call any constructor method.

Exceptions:

None.

Correctness:

typeTok shall be a valid typedef, typeref, or typespec metadata token.

Verifiability:

The type of the destination value on top of the stack shall be a managed pointer to some type destType, and typeTok shall be assignable-to destType. If typeTok is a non-reference type, the definition of subtyping implies that destType and typeTok shall be equal.