清单C / C ++的功能(在Unix中code分析) [英] Listing C/C++ functions (Code analysis in Unix)

查看:217
本文介绍了清单C / C ++的功能(在Unix中code分析)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论我们维持陌生code或检查出的Apache模块的实现细节,它可以帮助,如果我们能够迅速遍历code和建立的,我们正在寻找什么的概述。 grep的服务我的大多数日常需求,但也有一些情况下,它只是不会做。

Whether we're maintaining unfamiliar code or checking out the implementation details of an Apache module it can help if we can quickly traverse the code and build up an overview of what we're looking at. Grep serves most of my daily needs but there are some cases where it just wont do.

下面是它如何帮助一个常见的​​例子。为了找到一个PHP函数的我很感兴趣,我可以在命令行键入此定义的:

Here's a common example of how it can help. To find the definition of a PHP function I'm interested in I can type this at the command line:

grep -r "function myfunc" .

这可以非常迅速地适应C或C ++如果我们知道的返回类型,但如果说,我想列出每一个我的类提供方法的事情变得更加复杂:

This could be adapted very quickly to C or C++ if we know the return type, but things become more complicated if, say, I want to list every method that my class provides:

grep "function " ./src/mine.class.php

既然有这么表示一个函数或方法在C ++和,因为它是一般较为复杂的语法,我想我会需要某种静态的code分析工具,智能使用了C preprocessor的没有单一的关键字或盲目信仰codeR遵循严格的code准则(空白#,花括号等的位置),以获得这些类型的结果。

Since there's no single keyword that denotes a function or method in C++ and because it's generally more complex syntax, I think I'd need some kind of static code analysis tool, smart use of the C Preprocessor or blind faith the coder followed strict code guidelines (# of whitespace, position of curlies etc) to get these sorts of results.

你有什么建议?

P.S。是很好的,这是我的第一篇文章;-):P

p.s. be nice, this is my first post ;-) :p

推荐答案

通过Doxygen的运行它。它会抱怨缺少评论,但它仍然会产生调用图并列出所有功能。在HTML psented的链接$ P $遵循code路径。

Run it through Doxygen. It will complain about lack of commenting , but it will still produce call graphs and list all the functions. Presented in HTML with links to follow code paths.

doxygen的

这篇关于清单C / C ++的功能(在Unix中code分析)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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