对于生成的代码,我可以选择缩进或不缩进大括号,这些大括号仅用于在范围内容纳变量。目前它没有在这个级别缩进,我想知道我是否要通过缩进来暗示嵌套结构?常见的做法是什么?
/* loop through the total number of letter a rules */
for (a = 0; a < (number_a_rules - 1); a++)
{
/* loop through secondary position rules */
{
int a2end = arulestableend[2];
for (int a2 = arulestablestart[2]; a2 < a2end; a2++)
{
/* stuff */
}
}
} /* end for a 0 to numberarules -1 */
相对
/* loop through the total number of letter a rules */
for (a = 0; a < (number_a_rules - 1); a++)
{
/* loop through secondary position rules */
{
int a2end = arulestableend[2];
for (int a2 = arulestablestart[2]; a2 < a2end; a2++)
{
/* stuff */
}
}
} /* end for a 0 to numberarules -1 */
澄清:使用调试器额外的缩进意味着另一个级别的循环难以阅读的代码......