明确地将您的单位名称添加到Delphi的项目来源的优点和缺点 [英] Pros and cons of explicitly adding your unit names to Delphi's project source

查看:100
本文介绍了明确地将您的单位名称添加到Delphi的项目来源的优点和缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Delphi多年和几年,我的每个项目都是从源代码编译成exe - 没有包等。如果在任何地方使用'MyUnitA.pas',它只是在接口或实现部分中声明需要另一个单位。这一切在所有地方都很好,意味着在我的项目源(dpr)中,只有框架定义(似乎需要它们不在框架列表中显示)和必须调用的单元的奇怪定义非常早,例如madExcept,FastMM等。



我注意到XE有时候会在dpr中解析出来,直到你实际编译它。此外,当使用包时,它会发出警告,如果事件必须被隐式拉入,而不被明确地添加到包中。这让我想知道我们是否应该将我们所有使用过的单位都加入到我们的dpr(如软件包定义)或右键单击项目和添加到项目中。你做什么?

解决方案

(在Delphi Xe3 Enterprise上测试)

1 000 000行项目,1000个班,300个单位




  • 第一种方法:

    • 搜索路径仅包含vcl源路径

    • 在具有路径名(约300个文件)的项目文件中声明的所有文件

    • 我遇到了很多麻烦:

      • Delphi Ide在任务管理器中永久挂起100%cpu

      • 许多下划线的代码,主要是标识符没有找到

      • Ctrl + Enter符号不工作大部分时间

      • 项目文件很难编辑,不得不等待几秒钟每个关键笔划





  • 第二种方法

    • 项目选项(〜50路径)中的所有搜索路径

    • 在项目文件中声明的所有文件没有任何路径名(约300个文件)

    • 结果:

      • 在Delphi Ide中没有更多的挂机

      • 代码中没有更多下划线标识符

      • 项目文件响应更快

      • 更快的编译时间(〜10-15%)

      • 我的法定母亲离开了房子, li>

    • 缺点:$ b​​ $ b

      • 查找文件中的项目文件,不可用,使用在目录中搜索

        选项。但是它也会扫描不是从我的项目中的文件。

        对我来说这不是一件大事。


    / li>

I've been using Delphi for years and years and each of my projects is compiled from source into the exe - no packages etc. If 'MyUnitA.pas' is used anywhere, it is simply declared in the interface or implementation section of another unit that requires it. This all works fine everywhere and means that in my project source (dpr) there are only frame definitions (which seem to be needed there else they dont show up in the frame list) and the 'odd' definition of a unit that must be called very early eg madExcept, FastMM etc.

I notice that XE baulks a bit sometimes at resolving stuff in the dpr until you actually compile it. In addition, when working with packages its a warning if stuff has to be implicitly pulled in without having been explicitly added to the package. This got me wondering whether we should be diligently adding ALL of our used units to our dpr (like the package definition) or right-click project and 'Add to project'. What do you do?

解决方案

(Test made on Delphi Xe3 Enterprise)
1 000 000 lines project, 1000 classes, 300 units

  • First approach :
    • Search path contains only vcl sources paths
    • All files declared in project file with pathnames (around 300 files)
    • I had lots of troubles :
      • The Delphi Ide was hanging permanently, with "100% cpu" in the task manager
      • Lots of underlined code , mostly "identifiers not found"
      • Ctrl+Enter on symbols was not working most of the time
      • Project file very hard to edit, had to wait few seconds after each key stroke

  • Second approach :
    • All search paths in project options (~50 paths)
    • All files declared in project file without any pathnames (around 300 files)
    • Results :
      • No more hangings in Delphi Ide
      • No more underlined identifiers in code
      • Project file much more responsive
      • Faster compile time (~ 10-15%)
      • My mother in law left the house
    • Cons :
      • "Find in files" for project file, unusable, I had to use the "Search in directories"
        options. But it will also scan files not from my project.
        For me it's not a big deal

这篇关于明确地将您的单位名称添加到Delphi的项目来源的优点和缺点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆