DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(indent.info.gz) Breaking long lines

Info Catalog (indent.info.gz) Indentation (indent.info.gz) Indent Program (indent.info.gz) Disabling Formatting
 
 Breaking long lines
 ===================
 
    With the option `-lN', or `--line-lengthN', it is possible to
 specify the maximum length of a line of C code, not including possible
 comments that follow it.
 
    When lines become longer then the specified line length, GNU `indent'
 tries to break the line at a logical place.  This is new as of version
 2.1 however and not very intelligent or flexible yet.
 
    Currently there are two options that allows one to interfere with the
 algorithm that determines where to break a line.
 
    The `-bbo' option causes GNU `indent' to prefer to break long lines
 before the boolean operators `&&' and `||'.  The `-nbbo' option causes
 GNU `indent' not have that preference.  For example, the default option
 `-bbo' (together with `--line-length60' and `--ignore-newlines') makes
 code look like this:
 
        if (mask
            && ((mask[0] == '\0')
                || (mask[1] == '\0'
                    && ((mask[0] == '0') || (mask[0] == '*')))))
 
    Using the option `-nbbo' will make it look like this:
 
        if (mask &&
            ((mask[0] == '\0') ||
             (mask[1] == '\0' &&
              ((mask[0] == '0') || (mask[0] == '*')))))
 
    The default `-hnl', however, honours newlines in the input file by
 giving them the highest possible priority to break lines at.  For
 example, when the input file looks like this:
 
        if (mask
            && ((mask[0] == '\0')
            || (mask[1] == '\0' && ((mask[0] == '0') || (mask[0] == '*')))))
 
 then using the option `-hnl', or `--honour-newlines', together with the
 previously mentioned `-nbbo' and `--line-length60', will cause the
 output not to be what is given in the last example but instead will
 prefer to break at the positions where the code was broken in the input
 file:
 
        if (mask
            && ((mask[0] == '\0')
                || (mask[1] == '\0' &&
                    ((mask[0] == '0') || (mask[0] == '*')))))
 
    The idea behind this option is that lines which are too long, but
 are already broken up, will not be touched by GNU `indent'.  Really
 messy code should be run through `indent' at least once using the
 `--ignore-newlines' option though.
 
Info Catalog (indent.info.gz) Indentation (indent.info.gz) Indent Program (indent.info.gz) Disabling Formatting
automatically generated byinfo2html