什么是托管类型?它们是特定于 Delphi 的吗?它们是特定于 Windows 的吗?

发布于 2024-10-23 16:06:32 字数 1095 浏览 2 评论 0原文

总结:

请查看下面的知识性评论。

=================================================== ============

我在很多 stackoverflow Delphi 主题中都看到过托管类型这一术语。例如,正确初始化/终结主题中提到了它。但是,当我用 google 搜索托管类型时,似乎大多数链接都与 C++ 或 .NET 相关。例如,请参阅 MSDN 页面 。有人可以帮忙评论一下 Delphi 中定义的托管类型吗?鉴于 Delphi for POSIX/MacOS 即将诞生,托管类型是否特定于 Windows?感谢您提前付出的努力和时间!

PS:正确初始化/终结的主题:
在 Delphi 中哪些变量会被初始化?
delphi 变量默认使用值初始化吗?
我应该如何释放数组Delphi 7 析构函数中的对象数量?
在 Delphi 2009 中我需要释放变体数组吗?< /a>

Summarization:

Please check the knowledgeable comments below.

==============================================================

I have seen the term of managed types mentioned in quite a few stackoverflow Delphi topics. For example, it is mentioned in topics of correctly initializing/finalizing. However, when I google managed types, it seems most links are related to C++, or .NET. For example, see the MSDN page. Could some one help to comment what are managed types defined in Delphi? Given that Delphi for POSIX/MacOS is being born, are managed types specific to Windows? Thanks for your effort and time in advance!

PS: Topics of correctly initializing/finalizing:
Which variables are initialized when in Delphi?
Are delphi variables initialized with a value by default?
How should I free an array of objects in a Delphi 7 destructor?
In Delphi 2009 do I need to free variant arrays?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

薄暮涼年 2024-10-30 16:06:32

Delphi 上下文中,托管类型是 Delphi 编译器自动为其生成生命周期管理代码的类型。这包括:

  • 字符串
  • Open 动态数组
  • 包含其他托管类型的
  • 记录 接口
  • (稍后编辑) 匿名方法
  • (稍后编辑) 变体

因为 Delphi 上下文中的托管类型是根据以下内容定义的Delphi 编译器生成的内容是特定于 Delphi 的。


在 .NET 世界中,开发人员不需要管理已分配内存的生命周期,因为 .NET 提供了一种自动机制来执行此操作:垃圾收集器。但是 .NET 包含处理 CLR 之外的事物的能力(例如:使用不针对 CLR 的本机 DLL)。该代码通常被称为未修改且不安全的。

在 .NET 上下文中,托管涉及 CLR 自动管理的内容,因此这是 .NET 特定术语!

In the context of Delphi, managed types are those types for whom the Delphi Compiler automatically generates lifecycle management code. This includes:

  • Strings
  • Open Dynamic Arrays
  • Records containing other managed types
  • Interfaces
  • (later edit) Anonymous methods
  • (later edit) Variants

Because managed types in the Delphi context are defined in terms of what the Delphi compiler generates, they're delphi-specific.


In the .NET world the developer doesn't need to manage the lifecycle of allocated memory because .NET provides an automatic mechanism for doing this: The Garbage Collector. But .NET includes the ability to work with things outside the CLR (example: using native DLL's that don't target the CLR). That code is usually called unamanged and unsafe.

In the context of .NET managed relates to what the CLR automatically manages, so that's .NET specific term!

凉城凉梦凉人心 2024-10-30 16:06:32

请参阅Barry Kelly 对相关主题的回答
由于托管类型是一种语言功能,因此 Mac OS 等不应有重大变化。

See Barry Kelly's answer to a releated thread.
Since managed types are a language feature there shouldn't be significant changes on Mac OS et al.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文