# Returning to learning C++



## neilms (Dec 20, 2017)

Hi everyone,
I bought a copy of Struostrups ‘Principles and practice of C++’. I started working through it but stopped studying due to other commitments.
Anyway now I plan to continue working through the book. I guess that FreeBSD has improved a lot over the last 6 months or so. I’m planning on using my FreeBSD laptop as a development machine only for this purpose. I think I have version 11 at the moment. Do I need to upgrade?
Thanks


----------



## SirDice (Dec 20, 2017)

neilms said:


> I think I have version 11 at the moment. Do I need to upgrade?


If it's 11.0, yes. FreeBSD 11.0 is now end-of-life and not supported any more.


----------



## ralphbsz (Dec 20, 2017)

From a FreeBSD viewpoint, look at SirDice's answer above.
From a C++ viewpoint: Any compiler that is younger than 10 or 15 years is sufficient for studying C++, until you get into the very fine details.


----------



## tankist02 (Dec 20, 2017)

Latest compilers support standards C++11 and C++14, these can make your code less verbose and more robust.


----------



## Stephen MacKenzie (Dec 29, 2017)

He (Stroustrup) wrote a good companion book to the one you are citing called "A Tour of C++."  He makes it available in pdf form on his website isocpp.org/tour   Herb Sutter, the current C++ Committee chair, recommends "A Tour of C++" as the goto book for learning what a C++ developer is expected to know.  It is only 192 pages.


----------



## kpedersen (Dec 30, 2017)

I might add "The C Programming Language" to the list (https://en.wikipedia.org/wiki/The_C_Programming_Language).

The reasons being:

1) It will help you understand the foundation of systems level development and why certain decisions by C++ were made. (Such as iterators, RAII and the STL).

2) It will help you know what *not* to do. I.e it will help you learn what is "unsafe" C code (i.e raw pointers, unchecked array access) and you can compare against the correct modern C++ alternative (i.e smart pointers, references and checked array access std::vector<T>::at(size_t).

3) Most libraries consumed by C++ developers are C libraries (such as SDL, sqlite, gtk+). You will need to know how to use enough C to integrate with them correctly from C++. I know there are C++ bindings for most C libraries, but often using the native C library has many advantages.

I think it is possible to learn C++ directly without learning any C but in general I find learning enough C to use C++ effectively is the best way to go. Not to mention the book is very small and succinct compared to any C++ ones so you wont exactly lose much time if you don't find it useful 

Also, I find making a simple game or something a great way to learn a new language. Perhaps try: http://lazyfoo.net/tutorials/SDL (This uses C++ but interfacing with a C library (SDL))

Finally, I suggest avoiding anything fancy. For now avoid IDEs and instead use a simple text editor and clang++ from the command line to help you understand about linking, include directories etc...
For the same reason I also recommend avoiding anything higher than C++0x (C++98 and smart pointers). I find *auto*, *lambdas* and *async* to contribute to confusion with beginners.


----------



## Snurg (Dec 30, 2017)

As kpedersen said, K&R's book is still the best one to start with.
When you read "The C++ Programming language" of Stroustrup, you will notice the many references he makes to K&R's work.

I would recommend both above books above everything else.
Just because I never found better books about the topic.

(If you buy the K&R book secondhand, make sure you take at least the 2nd edition. The first one covers pre-ANSI C and this is of almost historic value today.)


----------

