Live data from Hacker News

Ask HN: How to refresh on modern features of C++?

news.ycombinator.com

31–40 of 63 posts

Re: Ask HN: How to refresh on modern features of C++?

#31
post #27

Well at the risk of stating the obvious, there's a lot of armchair programmer style "read this", "watch this" instruction here. It's much better to do something concrete. Go and do a trivial project in it, cppreference.com and cplusplus.com have c++11 tags on the new features. I'm sure you've had ideas recently and I'm sure the project is less trivial than you thought! I think looking at language features first is "a…

People who learn C++ this way tend to miss stuff out, I think - there are a lot of thing that you can just muddle your way though without really understanding. I'm sure there are some people that think this will be OK; after all, lots of people say you don't really have to understand templates unless you're writing a library (and so on). But I don't think it will be OK. There was very little in C++98 (that I knew wel…

unless you knew all of it, pretty much, you couldn't really use any of it safely.

Thank you for perhaps the best summation of everything wrong with using C++ in a project, and everything wrong with C++ as a language!

Re: Ask HN: How to refresh on modern features of C++?

#32
post #28
post #26

You may like to read and search the questions on stackoverflow. They have a lot of C++11 and C++14 questions and code examples and many of the contributors are very experienced with C++. http://stackoverflow.com/tags/c%2b%2b11/info http://stackoverflow.com/tags/c%2b%2b14/info I use C++ almost daily. I love it. I've used it for many years now. Having said that, I try to avoid the newer standards unless I absolutely mu…

I too worked with C++ for years but I haven't for some time. I plan to learn the C++11 stuff and get back up to speed because I hate the feeling of falling behind in a language that really has no competition in the niche it fills. Here is a somewhat off-topic question for you: what is the job market like for C++? Is it mostly maintaining/enhancing legacy code or is there considerable new code being written in C++?

It's been just more than two years since I was paid to write software. I was a systems programmer. My knowledge is a bit dated. The C++ code I write today is to support IT security research (job) and my own personal interests (hobbies).

When I worked in systems programming (automobile systems research), C++ was very popular in the embedded/systems space. I believe it still is. Many systems people I knew were porting C to C++. Old code was maintained and new code was written. I'd say the break-down was about 50 50. In addition to adding C++ features, maintaining C compatibility was paramount.

I never worked with higher-level applications, but I'm sure that there's a lot of C++ up there too (web browsers, office suites, etc). Maybe even more.

Re: Ask HN: How to refresh on modern features of C++?

#33

Well at the risk of stating the obvious, there's a lot of armchair programmer style "read this", "watch this" instruction here. It's much better to do something concrete. Go and do a trivial project in it, cppreference.com and cplusplus.com have c++11 tags on the new features. I'm sure you've had ideas recently and I'm sure the project is less trivial than you thought! I think looking at language features first is "a…

I think you make a very valid point and I would agree to an extent. However I wouldn't discount the value in seeking to understand the personality and capabilities of a language as it evolves over time.

I think of any language as another tool in my toolbox. The better I know a tool, the better I know when and how to apply it to a specific problem.

I'd wager that just one trivial project won't fully demonstrate the personality and capabilities of a language.

Re: Ask HN: How to refresh on modern features of C++?

#35
post #28
post #26

You may like to read and search the questions on stackoverflow. They have a lot of C++11 and C++14 questions and code examples and many of the contributors are very experienced with C++. http://stackoverflow.com/tags/c%2b%2b11/info http://stackoverflow.com/tags/c%2b%2b14/info I use C++ almost daily. I love it. I've used it for many years now. Having said that, I try to avoid the newer standards unless I absolutely mu…

I too worked with C++ for years but I haven't for some time. I plan to learn the C++11 stuff and get back up to speed because I hate the feeling of falling behind in a language that really has no competition in the niche it fills. Here is a somewhat off-topic question for you: what is the job market like for C++? Is it mostly maintaining/enhancing legacy code or is there considerable new code being written in C++?

I hate the feeling of falling behind in a language that really has no competition in the niche it fills.

Well, that's no longer true - Rust and Go are two contenders for C++'s "niche". They are still growing, but are already much nicer languages than C++. In some situations Erlang or Ocaml can also replace C++ successfully.

Re: Ask HN: How to refresh on modern features of C++?

#36
post #27

Earlier quoted context omitted.

People who learn C++ this way tend to miss stuff out, I think - there are a lot of thing that you can just muddle your way though without really understanding. I'm sure there are some people that think this will be OK; after all, lots of people say you don't really have to understand templates unless you're writing a library (and so on). But I don't think it will be OK. There was very little in C++98 (that I knew wel…

obviously we disagree! i think it's ok to miss out on language features. templates, as you say yourself you're ok not to know. you're also not ok not to know exceptions. there's other stuff too, you can get away without the C preprocessor. C++ is too big to know all of and it's a waste of time to invest time trying to, unless you are on a standards committee or are writing a compiler...(and even then you can get away…

I agree; sometimes you have to start somewhere. Then come back and improve knowledge. Trying to be a theoretical expert early on will bite you

Re: Ask HN: How to refresh on modern features of C++?

#38
post #27

Earlier quoted context omitted.

People who learn C++ this way tend to miss stuff out, I think - there are a lot of thing that you can just muddle your way though without really understanding. I'm sure there are some people that think this will be OK; after all, lots of people say you don't really have to understand templates unless you're writing a library (and so on). But I don't think it will be OK. There was very little in C++98 (that I knew wel…

obviously we disagree! i think it's ok to miss out on language features. templates, as you say yourself you're ok not to know. you're also not ok not to know exceptions. there's other stuff too, you can get away without the C preprocessor. C++ is too big to know all of and it's a waste of time to invest time trying to, unless you are on a standards committee or are writing a compiler...(and even then you can get away…

unless you are on a standards committee or are writing a compiler...

Or you work on an existing codebase. Most C++ code that I worked on had templates, exceptions, and used the C preprocessor.

I used to have your attitude. This works for many languages, e.g. if you know some of the syntax of Python or Go and the usual stuff from the standard library, you can get pretty far.

If you want to write modern C++, this is not really true. You need to know about const correctness, lifetimes, some templates, etc. Or you cannot deal with most projects or libraries, like Boost, Eigen, etc.

It's like saying you can program Haskell in 2014 without knowing typeclasses, lenses, GADTs, etc. You can write some educational form of Haskell, sure. But many libraries use these.

Re: Ask HN: How to refresh on modern features of C++?

#39
post #28

Earlier quoted context omitted.

I too worked with C++ for years but I haven't for some time. I plan to learn the C++11 stuff and get back up to speed because I hate the feeling of falling behind in a language that really has no competition in the niche it fills. Here is a somewhat off-topic question for you: what is the job market like for C++? Is it mostly maintaining/enhancing legacy code or is there considerable new code being written in C++?

I hate the feeling of falling behind in a language that really has no competition in the niche it fills. Well, that's no longer true - Rust and Go are two contenders for C++'s "niche". They are still growing, but are already much nicer languages than C++. In some situations Erlang or Ocaml can also replace C++ successfully.

As much as I like Rust, it is in its infancy and it will be years before it gains similar traction, if it ever does. The other languages you mentioned are not in the same category (garbage collection alone excludes them).

Re: Ask HN: How to refresh on modern features of C++?

#40
post #36

Earlier quoted context omitted.

obviously we disagree! i think it's ok to miss out on language features. templates, as you say yourself you're ok not to know. you're also not ok not to know exceptions. there's other stuff too, you can get away without the C preprocessor. C++ is too big to know all of and it's a waste of time to invest time trying to, unless you are on a standards committee or are writing a compiler...(and even then you can get away…

I agree; sometimes you have to start somewhere. Then come back and improve knowledge. Trying to be a theoretical expert early on will bite you

The thing is that most of the things that your parent mentions are not just some theory. Exceptions, templates, and the C preprocessor are used in most real-life C++ code.

I think starting from somewhere with modern C++ means not starting at C strings, arrays, and bare pointers but starting with STL containers, STL algorithms, and smart pointers etc. to build good habits. But eventually any good introduction has to cover C arrays etc. as well.

Back when I started C++, Accelerated C++ was that sort of introduction. But AFAIK it's not updated for C++ 11 or 14.

Post reply on HN