gpt4 book ai didi

if-statement - 使用 Uncrustify 为 If-else 添加大括号

转载 作者:行者123 更新时间:2023-12-04 04:51:27 24 4
gpt4 key购买 nike

我想知道是否有任何方法可以使用 Uncrustify 在嵌套的 If-else 中添加大括号。例如:

if( stat_error == -1 ){
if ( debug > 0 )
printf( "...ERROR ); //I would like to add braces around here.
exit( -1 );
} else {

我见过这个:
# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'.
mod_full_brace_if = add # ignore/add/remove/force

但它似乎不适用于嵌套条件。

有什么办法吗?

最佳答案

我在您的示例中使用 Uncrustify 的经验:

Add or remove braces on single - line if statement. Will not remove the braces if they contain an else.

mod_full_brace_if = add

Make all if / elseif / else statements in a chain be braced or not. Overrides mod_full_brace_if.

If any must be braced, they are all braced. If all can be unbraced, then the braces are removed.

mod_full_brace_if_chain = false
它对我有用。

关于if-statement - 使用 Uncrustify 为 If-else 添加大括号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20332918/

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