Weird parameters on call stack.

skybuck2000 <[email protected]> Fri, 11 Feb 2022 04:35:22 -0800 (PST)
Newsgroups alt.comp.lang.borland-delphi
Message-ID <[email protected]>
When breakpointing shows garbage in between parameters
(3463456(4564)5675&*()()()()()9))))()()

All kinds of crap on call stack... apperently it's garbage ?!?

Confusing to say the least.

Though it should not be crap... the values are set...

Is this an affect of const ?!

This could be why I don't like const.. not sure yet.


Example code:

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
	TRawBytes = TBytes;

	TAccountKey = record
		 EC_OpenSSL_NID : Word;
		 x: TRawBytes;
		 y: TRawBytes;

	end;

	TOperationBlock = Record
		block: Cardinal;
		account_key: TAccountKey;
		reward: UInt64;
		fee: UInt64;
		protocol_version: Word;     // Protocol version
		protocol_available: Word;   // Used to upgrade protocol
		timestamp: Cardinal;        // Timestamp creation
		compact_target: Cardinal;   // Target in compact form
		nonce: Cardinal;            // Random value to generate a new P-o-W
		block_payload : TRawBytes;  // RAW Payload that a miner can include to a blockchain
		initial_safe_box_hash: TRawBytes; // RAW Safe Box Hash value (32 bytes, it's a Sha256)
		operations_hash: TRawBytes; // RAW sha256 (32 bytes) of Operations
		proof_of_work: TRawBytes;   // RAW 32 bytes
		previous_proof_of_work: TRawBytes; // RAW 32 bytes
	end;



type
  TForm1 = class(TForm)
	Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
	{ Public declarations }
	class function Test(const newOperationBlock: TOperationBlock; var errors: String): Boolean;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

class function TForm1.Test(const newOperationBlock: TOperationBlock; var errors: String): Boolean;
begin  // set breakpoint here.

end;

procedure TForm1.Button1Click(Sender: TObject);
var
	b : TOperationBlock;
	v : string;
begin
	v:= 'test';

	b.block := 666;
	b.account_key.EC_OpenSSL_NID := 11;

	b.account_key.x := nil;
	b.account_key.y := nil;
	b.reward := 444444;
	b.fee := 555555;
	b.protocol_version := 6666;
	b.protocol_available := 7777;
	b.timestamp := 8888;
	b.compact_target := 9999;
	b.nonce := 111111;

    Test( b, v );

end;



end.