212Chapter7 • Miscellaneous Tools
int i;
char c;
long boota ;
After using indent with –
di8
option, the output will be as follows:
int i;
char c;
long boota;
You can also force creation of a new line for each identifier, using the –
bc
option. Con-
sider the following code segment:
int i, j, k;
char c;
long boota ;
After using the “
indent –di8 –bc
” command on these three lines, the result will be
as follows:
int i,
j,
k;
char c;
long boota;
In addition to these common methods, there are other ways to arrange identifiers in decla-
ration sections.
7.1.6Breaking Long Lines
Long lines can be broken using
indent
at a defined length. The –
l
option controls this
behavior. Consider the following line of code:
printf ("This is example of a long line.");
This line is 43 characters long. If we set the line limit to 40 characters using –
l40
com-
mand line option, the line will be broken as follows:
printf
("This is example of a long line.");
Lines with conditional operators may be broken more intelligently. Consider the following
if
statement:
if(((counter == 100) && (color == RED)) || (string[0] == 'S'))
Using options
“–l30 –bbo
” (break before Boolean operator) will be as follows:
if (((counter == 100)
&& (color == RED))
|| (string[0] == 'S'))
Next Page >>
<< Previous Page
Back to the Table of Contents