Live data from Hacker News

C++ For C Programmers

coursera.org

41–50 of 53 posts

Re: C++ For C Programmers

#41
post #4

Nice! However, I'd appreciate the converse more. I'm pretty well versed in C++, and every time I try to write something in C, I fall back to C++. I find memory management a pain without RAII, error handling a hassle without exceptions, and, well, anything really a pain without some sort of standard container library. I have the idea that there's good alternatives for these in C-land, but I'm unfamiliar with them and…

I can understand this - I know some C++ but I am not very good at it, so I usually go for C with "greenspunning", i.e. using an embedded scripting engine, e.g. guile/lua/spidermonkey

Re: C++ For C Programmers

#42
post #13

On another note: people claiming "C/C++" skills usually have neither.

Why do you say that?

By definition C++ is a different language (contrary to Objective-C that was "an extension to C"). It encompasses a lot (nearly all) of C but introduces also new concepts. For example and besides the evident OOP features, all the different types of casting, use of IO stream, default parameters...

Re: C++ For C Programmers

#44
post #33

OK I'm going to date myself here...when I studied comsci/CPrE in college, we started out with C and moved to C++ and then to Java. I guess it doesn't speak much for the depth of the classes that I found C++ pretty easy to get into and used it in higher level courses, such as one involving Open GL. I guess what I'm asking is... who uses just C any more ? I can only guess that if, by this point, your main expertise is…

There are many, many people who use C and rarely or never use C++. Most embedded work is done in C, the Linux and BSD kernels are in C, etc. There are a variety of reasons for this, with audit-ability and debug-ability being two big ones. Code space is also a reason, although there are ways to make C++ mostly behave the way you want it to on all but the teensy tiniest platforms (although the resulting code is sometimes a questionable upgrade over just writing the thing in C). A great number of language interpreters are also written in C rather than C++ (cpython being one of them) - easier bindings are one reason for this.

As another datum, where I went to school the intro to CS data structures and algorithms courses were taught in C++ and the operating systems course was taught in C. In my day to day work I use C and a tiny bit of assembly (more reading than writing).

Re: C++ For C Programmers

#45
post #13

On another note: people claiming "C/C++" skills usually have neither.

That is exactly right... It is like they are assuming that by knowing C, then implicitly they know C++. That's tremendously wrong and they will notice that as soon as they work on a non-so-small project.

But, what about a C++ programmer who knows the quirks of C?

Re: C++ For C Programmers

#46
post #15
post #2

I'm slightly afraid to learn C++ after being told so many horror stories. But for the low low price of free? Count me in.

If you need C++ for a living then you have no other option. If you want to enjoy programming then I recommend to stay away from C++. I have written a lot of software in C and C++ in my programming career but C++ is not fun anymore. There are so many (even free) implementations of better languages. For instance C#, Python, Go. If you want to learn a next generation language right now then you should look at Rust. It s…

You think Rust is beautiful but C++ is ugly? You don't know what you're talking about, do you?

Re: C++ For C Programmers

#48
post #40

Imho, C++ should be thought of as a new language with a degree of backward compatibility with old C code, not as a 'bigger C'. How I'd start: Lesson 1: Pointers don't exist in C++, we have references. Lesson 2: malloc() doesn't exist in C++ Lesson 3: Templates are awesome. Lesson 4: Smart pointers are awesome. Lesson 5: 'Structs' can have constructors, and they're awesome! Lesson 5.5: Exceptions are awesome! Lesson 6…

The instructor's (self-written) textbook gets terrible reviews on Amazon. Not a good sign.

http://www.amazon.com/For-Programmers-Third-Edition-3rd/prod...

Re: C++ For C Programmers

#49
post #40

Imho, C++ should be thought of as a new language with a degree of backward compatibility with old C code, not as a 'bigger C'. How I'd start: Lesson 1: Pointers don't exist in C++, we have references. Lesson 2: malloc() doesn't exist in C++ Lesson 3: Templates are awesome. Lesson 4: Smart pointers are awesome. Lesson 5: 'Structs' can have constructors, and they're awesome! Lesson 5.5: Exceptions are awesome! Lesson 6…

What's wrong with handling errors with status codes as opposed to exceptions? Just because it exists doesn't mean one has to use it, no?

Re: C++ For C Programmers

#50
post #40

Imho, C++ should be thought of as a new language with a degree of backward compatibility with old C code, not as a 'bigger C'. How I'd start: Lesson 1: Pointers don't exist in C++, we have references. Lesson 2: malloc() doesn't exist in C++ Lesson 3: Templates are awesome. Lesson 4: Smart pointers are awesome. Lesson 5: 'Structs' can have constructors, and they're awesome! Lesson 5.5: Exceptions are awesome! Lesson 6…

This is the approach taken by Bjarne in his new book "Tour of C++".

I tend to bash C and C++ a lot given their unsafe by default nature as a Pascal refugee, but at least C++ can be made safe when the right abstractions are used and I do like it anyway.

Post reply on HN