Layout
Consistent layout improves readability and enhances maintainability of source code. Layout conventions can also accurately and consistently represent the logical structure of the code. Use the following layout guidelines.
Blank lines and grouping
Identify the start of a new paragraph of code with a blank line. Each paragraph of code should contain variable declarations and statements related to the current operation.
Indentation
Use the default Visual C++ indentation styles. Tab-stops are four characters and braces are not indented. Despite using consistent tab-stops, convert tabs to spaces and use the smart-indenting option. To select tab settings, use the Option command on the Tools menu
.
Line length
Where possible, line length should not exceed 128 characters. Break up lines longer than this over multiple lines using indentation to indicate a broken line. For example:
if (nNewLen > DIM(szOld) ||
::GetWindowText(hWndCtrl, szOld, DIM(szOld)) != nNewLen ||
lstrcmp(szOld, pszNew) != 0)
{
See also