关于Delphi函数参数的问题

时间:2010-10-05 02:06:17

标签: delphi

我是一名C程序员,遇到过这个Delphi函数并且有几个问题。

procedure Init(const key; size: Integer; filler: Byte = $FF); overload
  1. 变量key没有指定类型,在这种情况下它的类型是什么?
  2. $FF”对变量filler的含义是什么?

2 个答案:

答案 0 :(得分:6)

Key参数是无类型参数。您可以在Rob KennedyWhat is an untyped parameter?

这篇精彩文章中找到更多信息

填充参数的$FF值(0xFF十六进制,255十进制)是默认值,因此如果您没有为此参数赋值,填充符将采用默认值。

当您调用init过程时,您可以通过以下两种方式调用:

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

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

答案 1 :(得分:0)

$ FF是变量填充的默认值,key是任何类型的常量值。它可能是整数或int64类型