如何在运行时查找所有全局变量? [英] how to find all global variables at runtime?

查看:174
本文介绍了如何在运行时查找所有全局变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个非常大的C程序,包含数百个文件;我想

知道什么都是

程序中定义的全局变量。我该怎么做。



谢谢


I've a very large C program consisting of hundred of files; I want to
know what are all
the global variables defined in the program. how do i do this.

thanks

推荐答案

你需要的是什么的软件工具静态代码分析使用源代码C:

http:// en。 wikipedia.org/wiki/Static_code_analysis [ ^ ]。



您可以查看以下列表: http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#C.2FC.2B.2B [ ^ ]。



您可以熟悉这些工具中的一些或每个选择适合你的东西;其中一些是开源的。



由于严格的架构,我希望你只拥有不需要太多此类分析的项目和整洁的实施。特别是,全局变量通常是一件坏事,是代码和项目设计不良的标志。很有可能避免它们或至少最小化。



-SA
What you need would be the software tool for static code analysis working with the source C code:
http://en.wikipedia.org/wiki/Static_code_analysis[^].

You can review this list: http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#C.2FC.2B.2B[^].

You can get familiar with some or each of those tools and choose what could work for you; some of them are open-source.

And I would wish you to "have" only the projects which don't require much of such analysis, due to strict architecture and neat implementation. In particular, global variables is generally a bad thing, a sign of bad code and project design. It's quite possible to avoid them or at least minimize.

—SA


这篇关于如何在运行时查找所有全局变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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