VAR 引用参数的问题
在处理SOCKET 数据传输的时候
function ReceiveBuf(var Buf; Count: Integer): Integer;
function SendBuf(var Buf; Count: Integer): Integer;var Buf 传递的是地址 但是为什么 以下两种方式都可以呢1 )var aa :array[0..1098] of byte 
ReceiveBuf(aa,1099)2)var aa pointer 
ReceiveBuf(aa^,1099)不是指针地址吗? 数组名 和 aa^ 在这里 有什么不同

解决方案 »

  1.   

    delphi 没有像 c 里的 void,void *, 但定义参数时
    无类型则类似于 const void &(这个 c 应该也不支持, 如果支持的话应该是这样写)
    而 var buf 则是 void &c++ 中也有引用形式参数, 用指针作为参数你看是不要取地址?delphi 也是这样道理了
      

  2.   

    传aa,传的是aa的地址;
    传aa^,传的是aa[0]的地址。
    都是一样的。
      

  3.   

    var Buf 应该是任意类型的吧,你觉得呢
      

  4.   

    这种参数是无类型参数
    http://www.delphibbs.com/keylife/iblog_show.asp?xid=13185帮助里也说的很清楚
    You can omit type specifications when declaring var, const, and out parameters. (Value parameters must be typed.) Within a procedure or function body, untyped parameters are incompatible with every type. To operate on an untyped parameter, you must cast it. In general, the compiler cannot verify that operations on untyped parameters are valid.