开发者

How do I force opening braces to share the previous code line?

Using the Uncrustify tool I would like to apply the 1TBS style, which places braces like this开发者_JAVA百科:

if (x < 0) {
    printf("Negative");
}

How do I do this? I can't seem to find the right options.


I think you need to set nl_if_brace to ignore/add/remove/force.

Also, check the sp_else_brace and sp_brace_else options. Set it to 1, otherwise your code will end up with code such as:

if (condition){

instead of

if (condition) {


There's a tool called UniversalIndentGui that lets you play with Uncrustify's various tersely-worded settings and see immediate impact on a block of sample code.

Screenshots of UniversalIndentGUI

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜