gpt4 book ai didi

c++ - 将所有 { 移动到函数名称的右侧?

转载 作者:太空宇宙 更新时间:2023-11-03 10:21:09 25 4
gpt4 key购买 nike

我正在合并一些代码,这段代码的功能都是这样的:

void someFunction()
{

}

虽然我们所有的代码都需要:

   void someFunction() {

}

我想知道是否有一种方法可以查找和替换以便立即更改所有内容。这会节省我的工作时间。

我正在使用 VS 2008。

谢谢

最佳答案

有一个名为 Artistic Style 的优秀开源代码重新格式化程序正是为此目的而设计的。使用您想要遵循的样式设置对其进行配置,它就可以正常工作。强烈推荐。

Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C# and Java programming languages.

When indenting source code, we as programmers have a tendency to use both spaces and tab characters to create the wanted indentation. Moreover, some editors by default insert spaces instead of tabs when pressing the tab key, and other editors (Emacs for example) have the ability to "pretty up" lines by automatically setting up the white space before the code on the line, possibly inserting spaces in a code that up to now used only tabs for indentation.

Since the NUMBER of space characters showed on screen for each tab character in the source code changes between editors (unless the user sets up the number to his liking...), one of the standard problems programmers are facing when moving from one editor to another is that code containing both spaces and tabs that was up to now perfectly indented, suddenly becomes a mess to look at when changing to another editor. Even if you as a programmer take care to ONLY use spaces or tabs, looking at other people's source code can still be problematic.

To address this problem, Artistic Style was created - a filter written in C++ that automatically re-indents and re-formats C / C++ / C# / Java source files. It can be used from a command line, or it can be incorporated as classes in another C++ program.

关于c++ - 将所有 { 移动到函数名称的右侧?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4636672/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com