Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

C++

This is my main page about the C++ language.

C++ is not just object-oriented [1], nor just for generic programming [2], nor C with a few extensions [3].

Advice

  • View C++ as a federation of languages [4]
  • Express ideas directly in code [13]
  • Write in ISO Standard C++ [14]
  • Express intent [15]
  • Write programs that are clear and easy to maintain [3]
  • Ideally, a program should be statically type safe [16]
  • You should anticipate that your code will by modified, and possibly often, as change is the rule rather than the exception [3]
  • Follow the style of the code you modify [6]
  • Follow the Principle Of Least Astonishment [7]
  • Immediatly write proper code, instead of planning to refine it later [8]
  • Choose one style for brace placement [9]
  • Break long statements into multiple lines [10]
  • Include white space [11]
  • Encapsulate the interface to C or Fortan in C++ [12]

External links

References

  • [1] Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Page 32, 1.5 'Advice', item 7: 'C++ is not just object-oriented'
  • [2] Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Page 32, 1.5 'Advice', item 8: 'C++ is not just for generic programming'
  • [3] Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Page 32, 1.5 'Advice', item 16: 'C++ is not just C with a few extensions'
  • [4] Scott Meyers. Effective C++ (3rd edition).ISBN: 0-321-33487-6. Item 1: 'View C++ as a federation of languages'.
  • [5] Paul Deitel, Harvey Deitel. C++11 for programmers (2nd edition). 2014. ISBN: 978-0-13-343985-4. Chapter 3.4, Software Engineering Observation 3.1. page 50: 'Write programs that are clear and easy to maintain. Change is the rule rather than the exception. You should anticipate that your code will by modified, and possibly often.'
  • [6] Trevor Misfeldt, Gregory Bumgardner, Andrew Gray. The elements of C++ style. 2004. ISBN: 978-0-521-89308-4. Chapter 2.1, page 4: 'Adhere to the style of the original'
  • [7] Trevor Misfeldt, Gregory Bumgardner, Andrew Gray. The elements of C++ style. 2004. ISBN: 978-0-521-89308-4. Chapter 2.2, page 4: 'Adhere to the principle of least astonishment'
  • [8] Trevor Misfeldt, Gregory Bumgardner, Andrew Gray. The elements of C++ style. 2004. ISBN: 978-0-521-89308-4. Chapter 2.3, page 5: 'Do it right the first time'
  • [9] Trevor Misfeldt, Gregory Bumgardner, Andrew Gray. The elements of C++ style. 2004. ISBN: 978-0-521-89308-4. Chapter 3.1, page 8: 'Choose one style for brace placement'
  • [10] Trevor Misfeldt, Gregory Bumgardner, Andrew Gray. The elements of C++ style. 2004. ISBN: 978-0-521-89308-4. Chapter 3.1, page 11: 'Break long statements into multiple lines'
  • [11] Trevor Misfeldt, Gregory Bumgardner, Andrew Gray. The elements of C++ style. 2004. ISBN: 978-0-521-89308-4. Chapter 3.1, page 13: 'Include white space'
  • [12] Gottschling, Peter. Discovering Modern C++: An Intensive Course for Scientists, Engineers, and Programmers. Addison-Wesley Professional, 2015. Chapter 2.1: 'If you are ever forced to write software that interoperates with C or Fortan, write your software first with a concise and inituitive interface in C++ for yourself and other C++ programmers and encapsulate the interface to the C and Fortran' libraries so that it is not exposed to developers'
  • [13] C++ Core Guidelines: P.1: Express ideas directly in code
  • [14] C++ Core Guidelines: P.2: Write in ISO Standard C++
  • [15] C++ Core Guidelines: P.3: Express intent
  • [16] C++ Core Guidelines: P.4: Ideally, a program should be statically type safe