是否有适用于 C 和 C++ 的 lint 工具检查格式?

发布于 2024-08-25 05:46:02 字数 1803 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

晨曦÷微暖 2024-09-01 05:46:02

Google 使用 cpplint。这是他们的风格指南

Google uses cpplint. This is their style guide.

生生不灭 2024-09-01 05:46:02

Linux 内核使用一个工具来完成此任务 - 它称为 checkpatch。您必须修改它才能检查您的编码标准而不是他们的编码标准,但这可能是一个很好的工作基础。 (它也是为 C 代码而不是 C++ 设计的)。

The Linux kernel uses a tool that does exactly this - it's called checkpatch. You'd have to modify it to check your coding standards rather than theirs, but it could be a good basis to work from. (It is also designed for C code rather than C++).

黎歌 2024-09-01 05:46:02

看看Vera++,它有很多规则 已经可用,但好的部分是您可以修改它们或编写自己的规则。

Take a look at Vera++, it has a number of rules already available but the nice part is that you can modify them or write your own.

冷弦 2024-09-01 05:46:02

有几个程序可以在保存时自动为您进行格式化(例如 Eclipse)。您可以拥有每个人都可以使用的格式设置,以确保相同的格式。

提交代码时也可以自动应用此类格式。当您使用 SVN 时,执行此操作的系统称为 svn hooks。这基本上会启动一个程序来在提交发生时处理(或检查和拒绝)格式。

此网站说明了如何制作自己的网站。但也已经存在这样做的方法。

There are several programs that can do formatting for you automatically on save (such as Eclipse). You can have format settings that everyone can use ensuring the same formatting.

It is also possible to automatically apply such formatting when code is committed. When you use SVN, the system to do this is called svn hooks. This basically starts a program to process (or check and deny) the formatting when a commit happens.

This site explains how you can make your own. But also ones already exist to do this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文