Are there any lint tools for C and C++ that check formatting?

亡梦爱人 提交于 2019-12-03 02:08:32
Nikola Smiljanić

Google uses cpplint. This is their style guide.

caf

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++).

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!