gpt4 book ai didi

code-formatting - "Force"在 Uncrustify 中做什么?

转载 作者:行者123 更新时间:2023-12-03 07:34:08 25 4
gpt4 key购买 nike

许多选项包括Force值选项:

Add or remove space between nested parens

sp_paren_paren { Ignore, Add, Remove, Force }

这是什么意思?它与Add有何不同?

最佳答案

添加的意思是“如果尚不存在则添加”,这意味着如果某些内容已经存在,则保留它(以及单独的格式)。 Force 表示如果不存在则添加,如果存在则重新格式化:

// Original
if (cond) {
func();
}

// Add curly braces (already present, leaves formatting alone)
if (cond) {
func();
}

// Force curly braces
if (cond) {
func();
}

或者另一个例子:

// Original
if (cond)
func();

// Add curly braces
if (cond) {
func();
}

// Force curly braces (behaves just like add in this case)
if (cond) {
func();
}

关于code-formatting - "Force"在 Uncrustify 中做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8718654/

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