code-formatting - mac - run uncrustify
¿Qué hace "Force" en Uncrustify? (3)
Agregar significa "agregar si no está presente", lo que significa que si algo ya está allí, déjelo (y el formato solo). Forzar significa agregar si no está presente y reformatear si está presente:
// Original
if (cond) {
func();
}
// Add curly braces (already present, leaves formatting alone)
if (cond) {
func();
}
// Force curly braces
if (cond) {
func();
}
U otro ejemplo:
// Original
if (cond)
func();
// Add curly braces
if (cond) {
func();
}
// Force curly braces (behaves just like add in this case)
if (cond) {
func();
}
Muchas de las opciones incluyen la opción Valor de la Force :
Agregar o quitar espacio entre paréntesis anidados
sp_paren_paren{Ignore,Add,Remove,Force}
Qué significa eso? ¿Cómo es diferente de Add ?
Como "Agregar o eliminar X entre A y B"
Add : solo agrega una X cuando no aparece X
AB -> AXB
AXB -> AXB
AXXB -> AXXB
Remove : elimina todo lo que apareció X
AB -> AB
AXB -> AB
AXXB -> AB
Force : como dijo edwinc Remove luego Add -> Elimina todo (cualquier) X primero y agrega una X finalmente
AB -> AXB
AXB -> AB -> AXB
AXXB -> AB -> AXB
Pero a veces ''agregar X'' se puede definir como agregar un número X en otro lugar, por lo que a Force le gustará un "reformateo" como dijo Chris.
Add agrega si no está allí.
Remove elimina si está allí.
Force hace un remove luego un add .