[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.10 Disabling Formatting

Formatting of C code may be disabled for portions of a program by embedding special control comments in the program. To turn off formatting for a section of a program, place the disabling control comment /* *INDENT-OFF* */ on a line by itself just before that section. Program text scanned after this control comment is output precisely as input with no modifications until the corresponding enabling comment is scanned on a line by itself. The disabling control comment is /* *INDENT-ON* */, and any text following the comment on the line is also output unformatted. Formatting begins again with the input line following the enabling control comment.

More precisely, indent does not attempt to verify the closing delimiter (*/) for these C comments, and any whitespace on the line is totally transparent.

These control comments also function in their C++ formats, namely // *INDENT-OFF* and // *INDENT-ON*.

It should be noted that the internal state of indent remains unchanged over the course of the unformatted section. Thus, for example, turning off formatting in the middle of a function and continuing it after the end of the function may lead to bizarre results. It is therefore wise to be somewhat modular in selecting code to be left unformatted.

As a historical note, some earlier versions of indent produced error messages beginning with *INDENT**. These versions of indent were written to ignore any input text lines which began with such error messages. I have removed this incestuous feature from GNU indent.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by david on December, 15 2008 using texi2html 1.78.