Live data from Hacker News

Why You Should Know C++

unknownprogrammer.com

11–20 of 63 posts

Re: Why You Should Know C++

#11

Wow, I like C++ (at least, more than most), but I don't agree on any of those points. In fact, I am sad to say that unless your job requires it, I can't really think of any reason to learn the language. It relies on a mixture of paradigms that are easier learned from other languages where they are isolated. And for lolevel stuff, you are better off learning C.

If you take those points one by one, none of them is a reason to switch to C++. But for some kind of larger projects where efficiency is important, C++ is still one of the best choices.

I went from C++ to C# and wouldn't want to go back, but C++ is still a strong and lively language with many active projects and a good future. If I would be forced to implement something outside the .net framework, I would not hesitate to pick it up again.

Re: Why You Should Know C++

#12
I like to use C++ just as a better C.

Things like single line // comments and not having to declare all your variables at the top of your functions is really useful.

STL is also really useful in that you don't have to (badly) reinvent basic data structures like vectors and maps. Of course, STL also means reading compiler errors that are pages long... :-/

Re: Why You Should Know C++

#13
post #12

I like to use C++ just as a better C. Things like single line // comments and not having to declare all your variables at the top of your functions is really useful. STL is also really useful in that you don't have to (badly) reinvent basic data structures like vectors and maps. Of course, STL also means reading compiler errors that are pages long... :-/

Not only are comment styles a horrible reason to pick one language over another, but you need to get a new C compiler. // is part of c99 and can be used without any special work in modern gcc.

Also on the data structures. Base C does not include them but there are libraries for such data structures if you want such as glib.

Re: Why You Should Know C++

#14
post #12

I like to use C++ just as a better C. Things like single line // comments and not having to declare all your variables at the top of your functions is really useful. STL is also really useful in that you don't have to (badly) reinvent basic data structures like vectors and maps. Of course, STL also means reading compiler errors that are pages long... :-/

STL is way out of the realm of "just better C". It's pretty much several new concepts: object-oriented programming and aspect-oriented programming.

Re: Why You Should Know C++

#15

Wow, I like C++ (at least, more than most), but I don't agree on any of those points. In fact, I am sad to say that unless your job requires it, I can't really think of any reason to learn the language. It relies on a mixture of paradigms that are easier learned from other languages where they are isolated. And for lolevel stuff, you are better off learning C.

What's the point of using C when most modern programs on modern operating systems are written using frameworks that are a form of objectified C? All serious development frameworks nowadays for desktop applications are either C++ or Objective C. Most native libraries are one of the two. Even the driver SDKs are mostly build on an object oriented approach. And learning C++, you will know C. Your opinion is a popular op…

Learning C++ you will not know C. At least, not in the time it could have taken you to learn C by itself. There are a few core differences, and with C++ you'll spend a lot of time learning things that will distract you from the core language. If you want to learn C and understand it's advantages don't assume you'll pick up what you need by learning C++.

Re: Why You Should Know C++

#16
post #7

Earlier quoted context omitted.

What's the point of using C when most modern programs on modern operating systems are written using frameworks that are a form of objectified C? All serious development frameworks nowadays for desktop applications are either C++ or Objective C. Most native libraries are one of the two. Even the driver SDKs are mostly build on an object oriented approach. And learning C++, you will know C. Your opinion is a popular op…

Windows API is pure C. GTK is pure C. And these are quite serious (and not exactly obscure) development frameworks.

The Windows API is an array of functions that can be called the same from C as from C++. Microsoft provides several object oriented wrappers for this API, and it's very rare that any significantly large application is not calling the API over some kind of wrapper.

Re: Why You Should Know C++

#17
post #10

Earlier quoted context omitted.

What's the point of using C when most modern programs on modern operating systems are written using frameworks that are a form of objectified C? All serious development frameworks nowadays for desktop applications are either C++ or Objective C. Most native libraries are one of the two. Even the driver SDKs are mostly build on an object oriented approach. And learning C++, you will know C. Your opinion is a popular op…

C is the lingua franca of computer languages. You can create bindings for almost any language if you have a c library. A lot of system libraries are in fact C, not C++: think of stuff like zlib, curl, openssl, libxml, iconv.. Sure, if you know C++ well, you'll be able to do C, but learning C++ is that much harder than C, that it's often not worth the effort. You'll be able to interface with most libraries once you kn…

Learning C++ is not much harder than learning C. The difficulty in both languages lies in pointer manipulation and understanding the system below, it does not lie in using classes or templates. If you are a web developer who wants to interface with libraries then your approach is right, but if you are trying to develop a complete piece of software, then what you are saying is just wrong.

You seem to be locked down by a particular perspective on software development, and this is unfortunate.

Re: Why You Should Know C++

#18
post #12

I like to use C++ just as a better C. Things like single line // comments and not having to declare all your variables at the top of your functions is really useful. STL is also really useful in that you don't have to (badly) reinvent basic data structures like vectors and maps. Of course, STL also means reading compiler errors that are pages long... :-/

C99 has single line // comments. It also has the restrict tag.

About the idea of C++ as a better C, See "C++ - The Forgotten Trojan Horse". (http://ejohnson.blogs.com/software/2004/11/i_find_c_intere.h...)

If you're using C++ for the STL, keep in mind that the ML languages (OCaml, SML) also have compile-time parametric data structures, and they infer and check their usage for you.

They also have a proper module system, so when you change a private variable, you don't have to choose between linking errors or recompiling damn near every piece of C++ code in your source tree.

They're also pretty fast.

Re: Why You Should Know C++

#19
post #15

Earlier quoted context omitted.

What's the point of using C when most modern programs on modern operating systems are written using frameworks that are a form of objectified C? All serious development frameworks nowadays for desktop applications are either C++ or Objective C. Most native libraries are one of the two. Even the driver SDKs are mostly build on an object oriented approach. And learning C++, you will know C. Your opinion is a popular op…

Learning C++ you will not know C. At least, not in the time it could have taken you to learn C by itself. There are a few core differences, and with C++ you'll spend a lot of time learning things that will distract you from the core language. If you want to learn C and understand it's advantages don't assume you'll pick up what you need by learning C++.

Yes you will. It's better to learn C++ straight up, because the things you learn there will help you become a better modern developer compared to just C. The core differences between C and C++ (apart from the entire object oriented thing) are easy for any competent developer to pick up. Were they difficult for you to understand?

Re: Why You Should Know C++

#20
post #7

Earlier quoted context omitted.

What's the point of using C when most modern programs on modern operating systems are written using frameworks that are a form of objectified C? All serious development frameworks nowadays for desktop applications are either C++ or Objective C. Most native libraries are one of the two. Even the driver SDKs are mostly build on an object oriented approach. And learning C++, you will know C. Your opinion is a popular op…

Windows API is pure C. GTK is pure C. And these are quite serious (and not exactly obscure) development frameworks.

And, uh ... POSIX. The weapon of choice for UNIX black-belts.
Post reply on HN