tags:

views:

118

answers:

2

Hi, 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?
+5  A: 

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
RRUZ
The example calls to Init are missing the size parameter, which is not optional.
Alistair Ward
@Alistair, thanks is fixed now.
RRUZ
A: 

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

Kutsoff