AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

2020.12.21 19:03 "[Tiff] Reformat source: Add { curly brackets } for control statements", by OnlineCop

Could there be consideration to wrap multiple control statements within {...} curly brackets?

I'm referring mainly to multi-command statements like this where the flow continuation between many control statements is implicit:

for (tp = "\tt\bb\rr\nn\vv"; *tp; tp++)
if (*tp++ == *cp)
break;

and this:

for (i = NANGLES; i--; ) /* fill any holes */ 
if (eps[i] > 1.5) { 
int i1, i2; 
for (i1 = 1; i 1 < NANGLES/2; i1++) 
if (eps[(i+i1)%NANGLES] < 1.5) 
break; 
for (i2 = 1; i2 < NANGLES/2; i2++) 
if (eps[(i+NANGLES-i2)%NANGLES] < 1.5) 
break; 
if (i1 < i2) 
oog_table[i] = 
oog_table[(i+i1)%NANGLES]; 
else 
oog_table[i] = 
oog_table[(i+NANGLES-i2)%NANGLES]; 

initialized = 1;

I realize that wrapping ALL single-line control statements in `{...}` brackets may be undesirable, so I would like to discuss multi-command statements specifically.

I think the added verbosity would help avoid side-effects while someone is updating nearby sections of code.

@onlinecop