Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
Indenting is adding whitespace to make code easier to read
-
Indent the body of each function
one level within the braces that delimit the function's body [1]
-
Indent block statements [3]
-
Indent statements after a label [4]
-
Set a convention for the size of the indent you prefer, then apply it uniformly [2]
-
Some standards allow for tabs [2], others forbid them [5], to create indent
- Paul Deitel, Harvey Deitel. C++11 for progrgrammers (2nd edition). 2014. ISBN: 978-0-13-343985-4. Chapter 2.2, Good Programming Practice 2.1. page 22: 'Indent the body of each function one level within the braces that delimit the function's body. This makes a program's functional structure stand out and makes the program easier to read.'
- Paul Deitel, Harvey Deitel. C++11 for progrgrammers (2nd edition). 2014. ISBN: 978-0-13-343985-4. Chapter 2.2, Good Programming Practice 2.2. page 22: 'Set a convention for the size of the indent you prefer, then apply it uniformly. The tab key may be used to create indents, but tab stops may vary. We prefer three spaces per level of indent.'
- Trevor Misfeldt, Gregory Bumgardner, Andrew Gray. The elements of C++ style. 2004. ISBN: 978-0-521-89308-4. Chapter 3.1, page 7: 'Use indented block statements'
- Trevor Misfeldt, Gregory Bumgardner, Andrew Gray. The elements of C++ style. 2004. ISBN: 978-0-521-89308-4. Chapter 3.1, page 8: 'Indent statements after a label'
- Trevor Misfeldt, Gregory Bumgardner, Andrew Gray. The elements of C++ style. 2004. ISBN: 978-0-521-89308-4. Chapter 3.1, page 16: 'Do not use hard tabs'
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.
