Skip to content

Commit

Permalink
Added some Gottschling refs
Browse files Browse the repository at this point in the history
  • Loading branch information
richelbilderbeek committed Feb 27, 2017
1 parent c27d93e commit 75544bd
Show file tree
Hide file tree
Showing 13 changed files with 340 additions and 846 deletions.
54 changes: 10 additions & 44 deletions content/Cpp.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# C++
# [C++](Cpp.md)

This is my main page about the [C++](Cpp.md) language.

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



- [C++ code snippets](CppCodeSnippets.md): handy short pieces of code
- [C++ errors](CppError.md): my collection of [install
errors](CppInstallError.md), [compile errors](CppCompileError.md),
Expand Down Expand Up @@ -53,20 +51,7 @@ C++ is not just object-oriented \[1\], nor just for generic programming
- [C++ tools](Tools.md): use them, love them and download the source
code of my tools











[Advice](CppAdvice.md)
-----------------------


## [Advice](CppAdvice.md)

- View [C++](Cpp.md) as a federation of languages \[4\]
- Write programs that are clear and easy to maintain \[3\]
Expand All @@ -79,41 +64,17 @@ C++ is not just object-oriented \[1\], nor just for generic programming
- 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
--------------


## External links

- [WikiPedia's page about C++](http://en.wikipedia.org/wiki/C%2B%2B)
- [isocpp.org: C++ news](http://isocpp.org)
- [Software Engineering Code of Ethics and Professional
Practice](http://www.acm.org/about/se-code)











[References](CppReferences.md)
-------------------------------


## [References](CppReferences.md)

1. [Bjarne Stroustrup](CppBjarneStroustrup.md). The C++ Programming
Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Page 32, 1.5
Expand Down Expand Up @@ -151,3 +112,8 @@ External links
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'

96 changes: 32 additions & 64 deletions content/CppBigFour.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,55 @@
# ([C++](Cpp.md)) [Big Four](CppBigFour.md)











([C++](Cpp.md)) [Big Four](CppBigFour.md)
===========================================



The [Big Four](CppBigFour.md) are the following four special
In [C++98](Cpp98.md) the [Big Four](CppBigFour.md) are the following four special
[class](CppClass.md) [member functions](CppMemberFunction.md) \[1\]:



1. [Default constructor](CppDefaultConstructor.md)
2. [Copy constructor](CppCopyConstructor.md)
3. [Copy assignment operator](CppCopyAssignmentOperator.md)
4. [Destructor](CppDestructor.md)

 
In [C++11](Cpp11.md) there are the [Big Six](CppBigSix.md).

## Example

```
#include <iostream>

///Gossip is a class that tells you what is happening to it
struct Gossip
{
Gossip() { std::cout << "Default constructor\n"; }
Gossip(const Gossip&) { std::cout << "Copy constructor\n"; }
~Gossip() { std::cout << "Destructor\n"; }
Gossip& operator=(const Gossip&) { std::cout << "Copy assignment operator\n"; }



};
Example
-------

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
` #include <iostream> ///Gossip is a class that tells you what is happening to it struct Gossip {   Gossip() { std::cout << "Default constructor\n"; }   Gossip(const Gossip&) { std::cout << "Copy constructor\n"; }   ~Gossip() { std::cout << "Destructor\n"; }   Gossip& operator=(const Gossip&) { std::cout << "Copy assignment operator\n"; } }; int main() {   {     Gossip g; //Default constructor     const Gossip h(g); //Copy constructor     g = h; //Copy assignment operator     //Destructor of g and h   } }`
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 
int main()
{
{
Gossip g; //Default constructor
const Gossip h(g); //Copy constructor
g = h; //Copy assignment operator
//Destructor of g and h
}
}
```

Screen output:


```
Default constructor
Copy constructor
Copy assignment operator
Destructor
Destructor
``` 
----------------------------------------------------------------------------------------
` Default constructor Copy constructor Copy assignment operator Destructor Destructor`
----------------------------------------------------------------------------------------











[References](CppReferences.md)
-------------------------------


## [References](CppReferences.md)
1. [Herb Sutter](CppHerbSutter.md), [Andrei
Alexandrescu](CppAndreiAlexandrescu.md). C++ coding standards: 101
rules, guidelines, and best practices. 2005. ISBN: 0-32-111358-6.
Introduction 'Class Design and Inheritance'












63 changes: 63 additions & 0 deletions content/CppBigSix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# ([C++](Cpp.md)) [Big Six](CppBigSix.md)

Since [C++11](Cpp11.md) the [Big Six](CppBigSix.md) are the following six special
[class](CppClass.md) [member functions](CppMemberFunction.md):

1. [Default constructor](CppDefaultConstructor.md)
2. [Copy constructor](CppCopyConstructor.md)
3. [Move constructor](CppMoveConstructor.md)
4. [Copy assignment operator](CppCopyAssignmentOperator.md)
5. [Move assignment operator](CppMoveAssignmentOperator.md)
6. [Destructor](CppDestructor.md)

In [C++98](Cpp98.md) there were only four, called [the Big Four](CppBigFour.md).

## Example

```
#include <iostream>
///Gossip is a class that tells you what is happening to it
struct Gossip
{
Gossip() { std::cout << "Default constructor\n"; }
Gossip(const Gossip&) { std::cout << "Copy constructor\n"; }
Gossip(const Gossip&&) { std::cout << "Move constructor\n"; }
~Gossip() { std::cout << "Destructor\n"; }
Gossip& operator=(const Gossip&) { std::cout << "Copy assignment operator\n"; }
Gossip& operator=(const Gossip&&) { std::cout << "Move assignment operator\n"; }
};
int main()
{
{
Gossip g; //Default constructor
const Gossip h(g); //Copy constructor
g = h; //Copy assignment operator
//Destructor of g and h
}
}
```

Screen output:

```
Default constructor
Copy constructor
Copy assignment operator
Destructor
Destructor
``` 
## Advice
- Regarding the six operations above, implement as little as possible and declare as much as possible. Any operation not
implemented shall be declared as default or delete [1]
## [References](CppReferences.md)
1. Gottschling, Peter. Discovering Modern C++: An Intensive Course for Scientists, Engineers, and Programmers. Addison-Wesley Professional, 2015.
Chapter 2.5: 'Regarding the six operations above, implement as little as possible and declare as much as possible. Any operation not
implemented shall be declared as default or delete'
Loading

0 comments on commit 75544bd

Please sign in to comment.