Лучший C ++ Code Formatter / Beautifier

Вероятно, самая подробная и всесторонняя статья на this такова:

Нежное объяснение ключевого слова этого «this» в JavaScript

Идея позади this заключается в понимании того, что типы вызова функции имеют важное значение при установке значения this.


Когда возникают проблемы с идентификацией this, не спрашивайте себя:

Где this взято из ?

blockquote>

, но спросите себя:

Как вызывается функция ?

blockquote>

arrow function (специальный случай прозрачности контекста) спросите себя:

Какое значение имеет this, где определена функция стрелки ?

blockquote>

Этот настрой правилен при работе с this и избавит вас от головной боли.

127
задан 5 revs, 2 users 58% 18 October 2011 в 17:04
поделиться

1 ответ

AStyle can be customized in great detail for C++ and Java (and others too)

This is a source code formatting tool.


clang-format is a powerful command line tool bundled with the clang compiler which handles even the most obscure language constructs in a coherent way.

It can be integrated with Visual Studio, Emacs, Vim (and others) and can format just the selected lines (or with git/svn to format some diff).

It can be configured with a variety of options listed here.

When using config files (named .clang-format) styles can be per directory - the closest such file in parent directories shall be used for a particular file.

Styles can be inherited from a preset (say LLVM or Google) and can later override different options

It is used by Google and others and is production ready.


Also look at the project UniversalIndentGUI. You can experiment with several indenters using it: AStyle, Uncrustify, GreatCode, ... and select the best for you. Any of them can be run later from a command line.


Uncrustify has a lot of configurable options. You'll probably need Universal Indent GUI (in Konstantin's reply) as well to configure it.

120
ответ дан 24 November 2019 в 00:48
поделиться
Другие вопросы по тегам:

Похожие вопросы: