在Delphi中查找未使用的(也就是“死”)代码 [英] Finding unused (aka "dead") code in Delphi

查看:115
本文介绍了在Delphi中查找未使用的(也就是“死”)代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何工具可以确定是否使用函数/过程/方法/整个类?



我已经看到可以帮助知识渊博的开发人员跟踪未使用的代码片段的工具(大部分用于Delphi以外的语言),但大多数学习曲线和/或者需要大量的挖掘来确定是否使用代码片段。



Delphi的智能链接器据称这样做可以减少最终可执行文件的大小。不幸的是,智能链接器提供了什么信息并不表示一种方法来检索从hurd中剔除的内容。



诚然,即使可以找出智能链接器正在消除的内容,它可能非常保守,它的淘汰。

解决方案

该线程讨论删除未使用的单元,并讨论像Icarus Pascal Analyzer这样的工具。该工具将完成所有您需要的更多。
如何自动从使用中删除未使用的单位条款?


Are there any tools that can determine if a function/procedure/method/entire class is used?

I've seen tools that can help a knowledgeable developer track down unused fragments of code (most are for languages other than Delphi) but most have a steep learning curve and/or require considerable digging to determine if a code fragment is used or not.

Delphi's smart linker purportedly does this to reduce the size of the final executable. Unfortunately what little information is given on the smart linker doesn't indicate a way to retrieve what was culled from the hurd.

Admittedly, even if it is possible to find out what the smart linker is eliminating it may be very conservative with its culling.

解决方案

This thread discusses removing unused units, and talks about tools like Icarus Pascal Analyzer. That tool will do all you need and more. How to "automatically" remove unused units from uses clause?

这篇关于在Delphi中查找未使用的(也就是“死”)代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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