C中如何获取一个文件中所有函数的范围(即行号)?
我想在C语言中获取一个文件中所有函数的开始和结束行号。有谁知道Linux中是否有一个易于使用的工具用于此目的?
I want to get both the beginning and ending line numbers of all functions in a file in C. Does any one know that whether there is a easy-to-use tool in Linux for this purpose?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这仅给出了每个函数的起始行,但也许这已经足够好了。
如果代码是使用相当常见的约定编写的,则该函数应以第一列中包含
}
的单行结尾,因此在给定第一行的情况下很容易获得最后一行:This only gives the starting line of each function, but perhaps that is good enough.
If the code was written using fairly common conventions, the function should end with a single line containing
}
in the first column, so it is fairly easy to get the last line given the first: