I want to learn c++

Man of Honour
Joined
18 Oct 2002
Posts
13,262
Location
Northallerton/Harrogate
Hey people,

I last used C++ in anger in about 2004/5. I wasn't terribly good at it but could sort of muddle through other peoples' code and fix bugs here and there, whilst probably creating a whole load more.
The company swapped to C# for new products and the legacy ones were pretty much instantly abandoned (because they worked, weren't going to be updated with new functionality and hardly any customers still used them).

I've decided that 12 years later, having done basically no development work (mostly testing/hardware stuff) that I should probably learn c++ - just for myself rather than a career. I'm currently doing no development really, other than writing system tests occasionally in a Java-like thing called Apex.

The last time I tried to LEARN C++ I failed. University didn't really teach me anything; our C++ lecturer was a PhD student that just wanted to go on about how many girls he'd been with at the weekend.
I have "Accelerated C++" book, but looking at it it basically makes little sense to me. I am sure it's a good book because someone I was at uni with learned c++ way better than I or anyone else did and he did it via this book.

I don't really have access to MSDN anymore. Well no, I do not have any access to it. I have a macbook from work, and a PC at home, which I guess could run some kinda express version of visual studio... what exists for mac? That's my main (most accessible) machine at the moment.

Is it even worth it? I could learn C# again, but I'd like to learn C++ also.
Ideally at the end I could have some kind of application with a user interface that I can control some hardware with, like an arduino but a quick glance seems to suggest C++ isn't the best way.... but still...

Any suggestions? Assume I know NOTHING of the language or programming. I really need to start again from the ground up, as I can remember so little of anything.
 
Associate
Joined
7 Nov 2013
Posts
255
Location
Kent, England
C++ is great if you have a need for it, e.g. if you require near real-time, incredibly high-performance or for embedded systems. If you just want a language you can do a few projects in or dip your toes back into programming, there are many other languages which would be a better choice, C# is one such example.
 
Associate
Joined
16 Aug 2010
Posts
1,373
Location
UK
C++ is great if you have a need for it, e.g. if you require near real-time, incredibly high-performance or for embedded systems. If you just want a language you can do a few projects in or dip your toes back into programming, there are many other languages which would be a better choice, C# is one such example.

This really i.e. you require the advantages outlined that benefit from c++, or if you just want to learn it because you want to learn it :p.

That said, if you do C++ then later go onto C#, it's not hard at all and both are great to learn eventually. As someone who used C++ for a few years, going onto C# felt like I was in wonderland. Surprised at the ease of use and results and now I wouldn't use C++ unless I actually require the performance (e.g. game engines or computations).
 
Man of Honour
OP
Joined
18 Oct 2002
Posts
13,262
Location
Northallerton/Harrogate
Hmm I guess you're right. I don't think I'll be writing any game engines but I might want to dip my toes into Unreal Engine, for example. Last time I looked at it Kismet was new and exciting... probably UE3 when it first came out.

Maybe I'll just go back to C#... ok same question :) Any best resources for that?
 
Associate
Joined
16 Aug 2010
Posts
1,373
Location
UK
Hmm I guess you're right. I don't think I'll be writing any game engines but I might want to dip my toes into Unreal Engine, for example. Last time I looked at it Kismet was new and exciting... probably UE3 when it first came out.

Maybe I'll just go back to C#... ok same question :) Any best resources for that?

The UE4 C++ framework insulates you a lot from actual C++. You just need a vague idea of how it works, at least to get started.

There are plenty of good series around on YouTube for C#. Any aspect of C# you want to focus on in particular expanding about what you said? Web development, desktops applications, web application (somewhat joining the two there but a common trend now to have the "desktop application" UI actually in a browser :D), games?

You said you have a Mac. You can use Visual Studio on it if you run Windows on it obviously. If not, there is Mono for cross platform C# and there is also .NET core which is new and by MS that is also cross platform. MS owns Mono now so I think it's an exciting time for .NET and C# in general and it's only going to get bigger, better and definitely worth learning.
 
Soldato
Joined
20 Dec 2004
Posts
16,021
The UE4 C++ framework insulates you a lot from actual C++. You just need a vague idea of how it works, at least to get started.

True, it's actually quite easy to get going with C++ in UnrealEngine as you're not really using any advanced features of the language. There's probably a fair bit to be said for getting pushed into using UEs containers and stuff (they are largely synonymous with their STL counterparts), rather than labouring through static char arrays and all that stuff that I think puts people off C++.
 
Caporegime
Joined
18 Oct 2002
Posts
32,623
Personally, I don't find a big difference between using modern C++ and C# or Java. The later 2 can have some better interfaces windows or an SQL database buts its not a deal breaker.

You also have to consider that STL is basically built in and you should never really try to anything without it, and for the large part the same can be said for external libraries like Boost, Pocco or whatever other domain library you are working within. If you stripped out all the libraries form C# it would suck, so no need to do the same in C++.

What you also normally o is build up your own library of helper/utility functions. String manipulation, math, time, date, hash, threading, regex, logging etc. You build these up over the years shared with every project and they soon become incredibly powerful, and 100% customized.


I do a lot of prototyping in Python or R with access to machine learning, scientific and stats libraries etc. But a lot of time I actually prefer just to go straight in to C++ if I don't need to quickly test a complex algorithm. If I have some data I want to quickly analyze, e.g. get some descriptive statistics then I will code in C++ over python by choice because I can code in C++ faster than python and the program will run 10-20x faster.


C# and Java are actually quite big steps back form C++ IMO, a big lack of many libraries like numerical optimization or linear algebra, and when they exist they are either slower or more award to use. E.g. In c++ I can write code that will multiple 2 matrices and the code is this simple: A*B, can't do that in java because I can't overwrite the operators. Or templating, Java's generic are a joke in comparison.

Then there is the issue that I want to develop on OSX and deploy on linux, and I just don't trust Mono so C# is just a windows novelty to me.
 
Last edited:
Soldato
Joined
14 Oct 2009
Posts
9,557
Location
UK
Just started learning C++ myself, I am doing a module for my final year of uni that required it so before I go back in September I am going to hopefully have a good understanding of it!

I am learning via The New Boston on YouTube. I find it a lot easier to watch someone else doing and seeing the results rather than reading a book.
 
Suspended
Joined
24 Oct 2012
Posts
25,266
Location
Godalming
I've just started learning Python for the hell of it and I'm absolutely loving it. Last time I coded was as a kid in BASIC and later Turbo Pascal 7, that's as far as that went. I loved it then and only last week decided to pick it up again, and everyone seems to think that Python is the best for noobs like me so that's what I'm doing.

I'm currently using this book:

http://ebook-dl.com/item/python_programming_for_the_absolute_beginner_3rd_edition_michael_dawson/

I don't know how basic you want things to be explained, but this book is babysteps. It's really good and I'm learning a ton from it, going to start my own project at some point.

This post might not be helpful but I thought I'd share it any way as it's great fun, all the best :)
 
Associate
Joined
16 Aug 2010
Posts
1,373
Location
UK
Yes I would never use C# for anything mathematical like solving differential equations, matrices, number crunching etc and that's the consensus echoed in this thread. That's not really it's area/focus however. I think it's more for general software, backend development (ASP.Net) and more where you're not so much trying to squeeze out some performance and more focused in actual results.

Yes Python is a straightforward language to pick up. I use it everyday at work currently (not number crunching, having a break from that area) although I keep pushing to have my wicked way and use C#. One day.. :D.
 
Last edited:
Soldato
Joined
19 Oct 2008
Posts
5,954
There are some books in PDF format online you can easily use for C# if you go that route.
Personally I recommend a PluralSight subscription, think it's less than £30 a month for an individual. You can learn C# from beginning through to advanced, and whole lot more about most languages. Just be sure to try things out for yourself as you go tho, not just watch the videos from start to finish as you will learn by doing. There are two courses I went through, C# from scratch and C# fundamentals. There are lots of courses for C++ on there too.
I am surprised you cant remember much tho, i hadn't used a language since 2002 but was able to pick it back up recently.

Thanks to Pluralsight and a bit of dabbling with the last company I worked with I am now working with C# daily which I only started playing with last July:). Struggling a bit looking at more advanced code working alongside more advanced C# developers but doing fine and enjoying it immensely. I've done a lot of scripting in the past(Perl, VBS, some Ruby, TSL) and came from a COBOL background and struggle a bit with the OO side of things but getting better. I find I sometimes write quite a bit of code which works just that my colleagues point out an easier way I could have done it in C# - removing the need for some of my "for" statements for example- ha.

I'm quite a fan of Microsoft technologies - Visual Studo is simply fantastic and C# is a great language.
 
Last edited:
Associate
Joined
16 Aug 2010
Posts
1,373
Location
UK
There are some books in PDF format online you can easily use for C# if you go that route.
Personally I recommend a PluralSight subscription, think it's less than £30 a month for an individual. You can learn C# from beginning through to advanced, and whole lot more about most languages. Just be sure to try things out for yourself as you go tho, not just watch the videos from start to finish as you will learn by doing. There are two courses I went through, C# from scratch and C# fundamentals. There are lots of courses for C++ on there too.
I am surprised you cant remember much tho, i hadn't used a language since 2002 but was able to pick it back up recently.

Thanks to Pluralsight and a bit of dabbling with the last company I worked with I am now working with C# daily which I only started playing with last July:). Struggling a bit looking at more advanced code working alongside more advanced C# developers but doing fine and enjoying it immensely. I've done a lot of scripting in the past(Perl, VBS, some Ruby, TSL) and came from a COBOL background and struggle a bit with the OO side of things but getting better. I find I sometimes write quite a bit of code which works just that my colleagues point out an easier way I could have done it in C# - removing the need for some of my "for" statements for example- ha.

I'm quite a fan of Microsoft technologies - Visual Studo is simply fantastic and C# is a great language.

Try Resharper with visual studio. You'll enjoy the experience even more and it will also help you :).
 
Soldato
Joined
13 Jan 2003
Posts
23,816
You can use Apple's Xcode IDE for C++ (I do).

You'll find that most things work with C++ but there are some aspects of macs you'll need to use something Apple.. like Objective-C/C++ etc

In the end you can do C++ with VI and the command line (with make etc) which would teach you more about the compile chain etc.

I would also look at the Object Oriented aspects with books like OO patterns that are across all languages. Straustrupt's book is the C++ standard and theres a great book on the good code "Effective C++" that teaches you all the gotchas. (like what todo in a C++ constructor and what not todo)

Each IDE tends to be specific to the platform except things like Eclipse CDT etc however they can be a pig to setup initially.

You could make yourself a VM and run linux like ubuntu, then run a few IDEs in there - the beauty with this method is that any installed stuff stays neat and tidy in the VM. I do this for my astro stuff and keep the Xcode/OSX install clean without needing macports etc.
 
Soldato
Joined
13 Jan 2003
Posts
23,816
Personally, I don't find a big difference between using modern C++ and C# or Java. The later 2 can have some better interfaces windows or an SQL database buts its not a deal breaker.

You also have to consider that STL is basically built in and you should never really try to anything without it, and for the large part the same can be said for external libraries like Boost, Pocco or whatever other domain library you are working within. If you stripped out all the libraries form C# it would suck, so no need to do the same in C++.

What you also normally o is build up your own library of helper/utility functions. String manipulation, math, time, date, hash, threading, regex, logging etc. You build these up over the years shared with every project and they soon become incredibly powerful, and 100% customized.


I do a lot of prototyping in Python or R with access to machine learning, scientific and stats libraries etc. But a lot of time I actually prefer just to go straight in to C++ if I don't need to quickly test a complex algorithm. If I have some data I want to quickly analyze, e.g. get some descriptive statistics then I will code in C++ over python by choice because I can code in C++ faster than python and the program will run 10-20x faster.


C# and Java are actually quite big steps back form C++ IMO, a big lack of many libraries like numerical optimization or linear algebra, and when they exist they are either slower or more award to use. E.g. In c++ I can write code that will multiple 2 matrices and the code is this simple: A*B, can't do that in java because I can't overwrite the operators. Or templating, Java's generic are a joke in comparison.

Then there is the issue that I want to develop on OSX and deploy on linux, and I just don't trust Mono so C# is just a windows novelty to me.


Hehe C++ is a little slow too for parallel computation ;)

A lot of the C compilers still work by compiling functions one at a time, taking the code structure that the developer has made and compiling that.
Only the set based (SQL) and some of the functional ones move outside of the function-by-function.

There C/C++/C# language is not rigorous enough for the compiler to redefine data dependences.

I use OpenCL quite a bit - Objective-C++/C++ calling OpenCL/OpenGL. Then the C++ simply acts as a manager for the code, the algorithm and the GPU kernels themselves are the parallel powerhouse.

Once you get really big data, then really even things like Hadoop aren't great as they're simply breaking parallel computation down - but the system itself can't alter the program itself in terms of data structure. It does partition and move data but not restructure the data schema for better processing dependant on the task at hand.
 
Back
Top Bottom