Pointer(s)^ versus s[1]

前端 未结 7 1014
南旧
南旧 2021-02-12 14:56

In a function that reads data (data meaning exclusively strings) from disk, which should I prefer? Which is better?

A) DiskStream.Read(Pointer(s         


        
7条回答
  •  春和景丽
    2021-02-12 15:05

    The second option is definitely more "Delphi style" (if you look at the Delphi versions of the Windows API headers, you will see that most pointer parameters have been converted to var parameters).

    In addition to that, the second option does not need a cast and is much more readable IMHO.

提交回复
热议问题