Pretty Print

To PrettyPrint is to reformat the source code of programs. This might be accomplished by a PrettyPrinter program, and the process is referred to as PrettyPrinting.

A Pretty Printer will typically enforce house rules or personal rules as to indentation, placement of braces and the like. The same tool may also inject markup for SyntaxHighlighting of some forms (for example putting reserved words into bold, italics, and different fonts or colors), if the output medium supports it. However, such markup cannot (in most cases) readily be added to the 'source' document - not in the same way the whitespace in code can be reformatted. This creates some value in distinguishing the act of SyntaxHighlighting from that of PrettyPrinting.

Sometimes a text editor will have a pretty-print mode, either on command or on the fly. Sometimes the output of a PrettyPrint will be the version placed under configuration management - because enforcing a standard layout can reduce spurious VCS differences.

DeleteWhenCooked: Anyone care to recommend a C++ PrettyPrinter?

These are pretty good:

I've not actually used it but I'm aware of some work on "a pretty-printer for all occasions". See http://ftp.cwi.nl/CWIreports/SEN/SEN-R0115.pdf


Many syntax highlighters (SyntaxHighlighting) can be setup to mock the older style black and white PrettyPrinter, if the syntax highlighter allows bold reserved words in addition to regular font style. Some syntax highlighters do not allow bold fonts and only offer regular fonts with color highlighting.


See: CodingStyle, SyntaxHighlighting


EditText of this page (last edited November 26, 2014) or FindPage with title or text search