加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – System.IOUtils初始化的TPath记录在哪里?

发布时间:2020-12-15 04:17:16 所属栏目:大数据 来源:网络整理
导读:TPath记录具有类构造函数TPath.Create,它初始化类变量.但是,我找不到任何使用TPath.Create /被称为dispite的单元,所有变量都具有正确的值(TPath.PathSeparator,…). 解决方法 类构造函数由Delphi生成的初始化代码自动调用.类构造函数在声明它们的单元的初始
TPath记录具有类构造函数TPath.Create,它初始化类变量.但是,我找不到任何使用TPath.Create /被称为dispite的单元,所有变量都具有正确的值(TPath.PathSeparator,…).

解决方法

类构造函数由Delphi生成的初始化代码自动调用.类构造函数在声明它们的单元的初始化部分期间调用.

这在documentation中有更详细的描述:

A class constructor is a special class method that is not accessible to developers. Calls to class constructors are inserted automatically by the compiler into the initialization section of the unit where the class is defined. Normally,class constructors are used to initialize the static fields of the class or to perform a type of initialization,which is required before the class or any class instance can function properly. Even though the same result can be obtained by placing class initialization code into the initialization section,class constructors have the benefit of helping the compiler decide which classes should be included into the final binary file and which should be removed from it.

您可以通过启用Debug DCU然后在类构造函数中的代码上设置断点来看到这一点.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读