开发者

Is there any tool to standardize format of C++ code? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

开发者_Go百科 Improve this question

I'm looking for a tool that works on Windows to reformat some C++ code in my codebase. Essentially, I've got some code I wrote a while ago that I'd like to use, but it doesn't match the style I'm using in a more recent project.

What's the best way to reformat C++ code in a standard manner?

Billy3


GNU Indent should get you most of the way there


In Visual Studio: Edit / Advanced / Format Document

The format applied to the document will match the settings in: Tools / Options / Text Editor / C/C++

Visual Studio might not support all the formatting options you want applied to your document, in which case you'll need a separate tool (such as Paul Betts is suggesting) to format the way you want.


Astyle is one of the more popular tools.

Edit: I don't know why I didn't think about it when I first posted this, but you can also use Vim. The = command will reformat your code according to your indentexpr and cinoptions.


I vote for Uncrustify.

Otherwise: Best C++ Code Formatter/Beautifier


GC Great Code has been an old standby for me. It's quite configurable.

http://sourceforge.net/projects/gcgreatcode/


Visual Studio can. And most IDEs can.


I have also used AStyle in the past. I used this GUI for it to make it a bit easier (I think--it's been a while): Artistic Style for Windows: http://jimp03.zxq.net/


Eclipse/CDT can indent your code very well...

  • Its configurable.
  • You can also share the settings within your team/group/organization.

P.S. I am writing something about that in my Book Post comment if you have some direct questions. :-)


use AStyle ( inbuilt in codeblocks )

Step 1 : Select your code
Step 2 : Click on Plugins->Source Code Format (AStyle )

Hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜