Pascal 中的无类型指针
我可以用 Pascal 中的非类型化指针做什么? (为什么非类型化指针很好?)
What can I do with untyped pointers in Pascal? (Why untyped pointers are good?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我可以用 Pascal 中的非类型化指针做什么? (为什么非类型化指针很好?)
What can I do with untyped pointers in Pascal? (Why untyped pointers are good?)
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
在 Borland 系列 Pascal 中,您可以将类型化指针传递给非类型化指针类型的参数。 IOW
程序测试(x:指针);
还将接受 pchar 等。这对于低级例程特别有用,例如移动数据的例程( move() 或在内存范围中搜索特定值等、压缩特定内存范围等)。
有些人也将指针算术命名为一个原因,但例如 Delphi 也允许在 pchar 上这样做。
FPC 和 Delphi 2009+ 甚至允许在其他类型上使用。
In Borland family Pascal's, you can pass a typed pointer to a parameter of the untyped pointer type. IOW
procedure test (x:pointer);
will also accept pchar etc. This is particularly useful for lowlevel routines like e.g. a routine that moves data ( move() or searches a memory range for a certain value etc, compress a certain memory range etc).
Some people also name pointer arithmetic as a reason, but e.g. Delphi allows that on pchar too.
FPC and Delphi 2009+ even allow it on other types.