什么是托管类型?它们是特定于 Delphi 的吗?它们是否特定于 Windows? [英] What are managed types? Are they specific to Delphi? Are they specific to Windows?
问题描述
总结:
请查看下方知识渊博的评论.
Please check the knowledgeable comments below.
==============================================================
==============================================================
我在很多 stackoverflow Delphi 主题中都看到了 managed types
这个术语.例如,在正确初始化/终结
的主题中提到.然而,当我用谷歌搜索 managed types
时,似乎大多数链接都与 C++ 或 .NET 相关.例如,请参阅 MSDN 页面.有人可以帮助评论 Delphi 中定义的托管类型吗?鉴于用于 POSIX/MacOS 的 Delphi 正在诞生,托管类型是否特定于 Windows?提前感谢您的努力和时间!
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:正确初始化/终结
的主题:
在 Delphi 中初始化哪些变量?
delphi 变量是否默认使用值初始化?
我应该如何释放数组Delphi 7 析构函数中的对象数量?
在 Delphi 2009 中我需要释放变体数组吗?
推荐答案
在 Delphi
的上下文中,托管类型是 Delphi 编译器自动为其生成生命周期管理代码的那些类型.这包括:
In the context of Delphi
, managed types are those types for whom the Delphi Compiler automatically generates lifecycle management code. This includes:
- 字符串
打开动态数组- 包含其他托管类型的记录
- 接口
- (稍后编辑)匿名方法
- (稍后编辑)变体
因为 Delphi
上下文中的托管类型是根据 Delphi 编译器生成的内容定义的,所以它们是特定于 Delphi 的.
Because managed types in the Delphi
context are defined in terms of what the Delphi compiler generates, they're delphi-specific.
在 .NET 世界中,开发人员不需要管理分配内存的生命周期,因为 .NET 提供了一种自动机制来执行此操作:垃圾收集器.但是 .NET 包括处理 CLR 之外的事物的能力(例如:使用不针对 CLR 的本机 DLL).该代码通常称为不受管理且不安全的.
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.
在 .NET 的上下文中,托管与 CLR 自动管理的内容相关,所以这是 .NET 特定术语!
In the context of .NET managed relates to what the CLR automatically manages, so that's .NET specific term!
这篇关于什么是托管类型?它们是特定于 Delphi 的吗?它们是否特定于 Windows?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!