Is a dynamic array of Char allowed when the parameter type is open array of Char?

后端 未结 3 2032
时光说笑
时光说笑 2020-12-31 10:57

I was looking at Delphi: array of Char and TCharArray "Incompatible Types" and started experimenting. What I discovered is rather interesting.

proc         


        
3条回答
  •  独厮守ぢ
    2020-12-31 11:44

    Since the documentation specifically mentions open array parameters of type Char to be compatible with dynamic arrays, this should be a bug. From 'Open Array Parameters':

    function Find(A: array of Char): Integer;
    [...]
    Note: [...] The previous example creates a function that takes any array of Char elements, including (but not limited to) dynamic arrays. [...]

提交回复
热议问题