ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am sure many of you have heard about Linus Torvald's Rant on C++. At first, I thought he was crazy, but a lot of people agree with him that I've seen after looking at various comments on websites that journal tech news. I am looking to learn a language and am currently swayed towards C++, but I DO respect torvalds and it leads me to wonder... Many small programs are written in c. I have heard that c++ really isn't different than c as far as efficiency (I HATE bloated applications). I don't want to start a flamewar, but am looking for a balanced disscussion of c vs c++. What are the main differences?
Click here to see the post LQ members have rated as the most helpful post in this thread.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339
Rep:
C++ has some disadvantages e.g.: WTF style virtual/template/vector
and advantages e.g.: Functions that adapt to the type required and auto freeing pointers.
I am sure many of you have heard about Linus Torvald's Rant on C++. At first, I thought he was crazy, but a lot of people agree with him that I've seen after looking at various comments on websites that journal tech news. I am looking to learn a language and am currently swayed towards C++, but I DO respect torvalds and it leads me to wonder... Many small programs are written in c. I have heard that c++ really isn't different than c as far as efficiency (I HATE bloated applications). I don't want to start a flamewar, but am looking for a balanced disscussion of c vs c++. What are the main differences?
Programming in C++ can be easier because it has a lot of built in function/algorithm.
I personally don't use C++'s "special features" that much, as I really have no need for them as of yet. The only things I've done in C++ are usually little Arduino AVR programming experiments (the Arduino API is in C++), and a small console application I wrote that does little more than calculate a facing vector between two others (I was thinking I'd use this in a future game engine). You would give three parameters on the command line (the X, Y, and Z values of the first position), and it would spit out an X and Y angle that makes the first position "face" the other. Yeah, nothing all that speical, but it was in C++, utilizing object orientation.
To say that "It's [C++ is] made more horrible by the fact that a lot of substandard programmers use it" is really quite a feeble argument. C++ is arguably over complex and many of the feature are used without really understanding them. For example there is confusion for some programmers when to select inheritance, association and templates. The fire two are O-O issues (often known as the "is a" versus "has a" problem) the third element is part of the generic paradigm in C++. Having all of this in one language can be confusing and can lead to bad design decisions, but having it in a language doesn't mean that all design decisions will be bad. The key is to know when to use them.
C is a great language, particularly for system and low level programming; it can also be used for high level applications but for the higher level applications I prefer other languages. I really like C++, but I don't use all of its features in every program that I write, that's for sure. I would rather maintain a well designed well written C++ program over a well designed well maintained C program, but that is a personal choice, and I know that others in this forum would come to the opposite conclusion.
Why do I like C++ over C. I like the O-O support, it's not the best but it is good enough for what I do. I like the options to have templates but I have learnt that these should not used with extreme caution. I like the exception handling, inline functions and static variables. C++ has it's flaws but so does every language.
well, any rant with foul language can't really be taken as reasoned argument.
no matter who says it.
Linus seems to be up his own quite a lot lately. Like he's the overarching god of software.
in my extensive experience the whole of IT works in a generally sub standard
way, from an engineering point of view. An awful lot of it is ad-hoc and held together
with tape and wire. It's nothing to do with the languages.
It's to do with the people.
Last edited by bigearsbilly; 04-12-2010 at 04:29 AM.
With respect to your post 10, could you kindly give me an example where a C program cannot be considered a C++ program ! because I also used to think that every C program is a C++ program..
With respect to your post 10, could you kindly give me an example where a C program cannot be considered a C++ program ! because I also used to think that every C program is a C++ program..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.