Книга: Embedded Linux development using Eclipse

Code Style

Code Style

The CDT text editor incorporates “smart typing” features, that include things like autoindentation and formatting, that are controlled by the Code Style preference shown in Figure 3.20. You can select from among four built-in code styles that include:

• KR

• BSD/Allman

• GNU

• Whitesmiths


Figure 3.20: Code Style preference.

The primary difference among the four seems to be the location and indentation of opening and closing braces. The default is KR, where the opening brace is on the same line as the expression or key word that introduces the block. This seems to be the preferred style among Linux programmers.

For what it’s worth, my personal preference is BSD/Allman, where the opening brace is on the next line and indented to line up with the introductory expression. There are options to edit the built-in styles, import a style, and to create a completely new one.

Among the features you can edit in the built-in styles are Tab policy and Tab size. Tab policy specifies whether tabs are represented in the file by tab characters, 0x9, or spaces.

Оглавление книги

Оглавление статьи/книги

Генерация: 1.212. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз