seveleven
seveleven

Reputation: 707

Questions on Delphi function parameters

I'm a C programmer came across this Delphi function and have a few questions.

procedure Init(const key; size: Integer; filler: Byte = $FF); overload
  1. variable key doesn't have a type specified, what is the type of it in this case?
  2. What does the "$FF" means for the variable filler?

Upvotes: 2

Views: 860

Answers (2)

RRUZ
RRUZ

Reputation: 136391

The Key parameter is an untyped parameter. You can found more info in this great article from Rob Kennedy, What is an untyped parameter?

The $FF value (0xFF hex, 255 decimal) for the filler parameter is a default value, so if you do not assign a value to this parameter, the filler will take the default value.

When you call the init procedure you can call in these two ways:

Init(Data,1,19);//in this case the key parameter is set to 19

or

Init(Data,1); //in this case the key parameter is set to $FF

Upvotes: 6

kutsoff
kutsoff

Reputation: 345

$FF is default value for variable filler, key is an constant value of any type. It maybe integer or int64 type

Upvotes: 0

Related Questions