I have this code in Delphi Detours library which I'm trying to port:
type
TInstruction = record
Archi: Byte; { CPUX32 or CPUX64 ! }
AddrMode: Byte; { Address Mode }
Addr: PByte;
VirtualAddr: PByte;
NextInst: PByte; { Pointer to the Next Instruction }
OpCode: Byte; { OpCode Value }
OpType: Byte;
OpKind: Byte;
OpTable: Byte; { tbOneByte,tbTwoByte,... }
OperandFlags: Byte;
Prefixes: Word; { Sets of Prf_xxx }
...
end;
var
Inst: TInstruction;
begin
...
Inst := default (TInstruction); // <-
Inst.Archi := CPUX;
Pvt := PPointer(AIntf)^; // vTable !
PCode := PPointer(Pvt + Offset)^; // Code Entry !
Inst.NextInst := PCode;
...
end;
What does the "default
" keyword do?
I assume something like:
FillChar(Inst, SizeOf(TInstruction), 0);
Is my assumption correct?
interface
type reference-counted objects. see docwiki.embarcadero.com/Libraries/XE7/en/System.Finalize – SmithyDefault
was introduced in D2009, see: #8460537 – Selfmastery