Get your own compiler:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9
You can then compile using the Command:
g++-4.9 -std=c++14 -wall-werror-o2-o HelloWorld helloworld.cpp
Style Rules:
Macros should never is required in C + +.
Variables should is defined close to theiruse.
Don ' t use malloc/realloc, use new (or Smart Pointers)
Minimise use of void*, pointer arithmetic, Union and C-style casts
Minimise the use of c-style arrays and strings, use Vector/array (from c++11) and string instead.
In short, forget the C language.
C + + Standard Library
For efficiency reasons, STL are not object-oriented:
- Makes little use of inheritance, and
- Makes no use of virtual functions
The standard Template library (STL) was a part of the C + + library, Some others is:
Category One:
- The C Standard library
- Language support: <exception>, <ctime>,...
- Strings: <string>, <cstring>,...
- Numerics: <cmath>, <complex>,...
- I/o: <iostream>, <fstream>, <cstdio>,...
- Exception classes
- Smart pointers
- Classes for internationalisation support
Category Two:
Containers: vector, list, stack, ...
algorithms: find, sort, copy, ...
iterators is the glue between the two!
The compilation Process:
1. Preprocessing-handles meta-information (e.g., #include)
2. Compiling-translates C + + into machine code objects
3. Linking-merges objects into a single application
Google Open source Project style guide
The practice of language style is the best way to Learn. Understanding the Author's style of thinking, it means that language learning has reached a good standard.
The road is long ... There is no shortcut except Persistence. Good luck!
[c + +] Basic Ideas and Style guide