This is a discussion on C or C++ within the General Discussions forums, part of the Community Boards category; Originally Posted by Elysia Learning both languages is silly. C/C++ are merely different aspects of the same language. You can ...
As much as I like to believe in the omnipotence of C, could you explain that a little more? I think you're making a generalization that I'm not catching.you cannot write a real world application without C
>> Learn both.
You can absolutely write a real world application in C++ without learning C. Sure, learning C++ entails learning some (or even many) aspects of C, but that's different than learning the C language.
A language is more than just syntax. It is techniques and best practices as well. Learning both is an interesting and worthwhile endeavor, but it is hardly required to use either effectively.
I second both. Anyone silly enough to think just learning C++ and ignoring C will get them through is a fool. "Oh rats, the library is in C, I'm not using it". Why wouldn't you learn both? They're not the same language, but they're very similar in syntax. Knowing C++ doesn't make knowing C any less useful.
@Elysia, C is just as 'modern' as C++. OOP is not "the answer to the universe", you'd find C++ violates (or allows you to violate) many principles of SE, friend classes -- please, connascence abuse anyone?
It has a bigger standard library you say? Why is it then Boost is such a large dependency for many projects? And yes, there exist libraries that give C much, much more "standard" utilities. Such as glib.
Last edited by zacs7; 11-04-2009 at 05:06 PM.
I think you're confusing the definition of learning C++. It doesn't mean ignoring the C aspects of it, it just means not learning all the details specific to how to get things done in C.
I mean, I took a class in C 14 years ago and promptly forgot it. I haven't written anything in that language since. And I've gotten through as a professional C++ programmer just fine.
> But what are the differences exactly between C and C++
C++ provides OOP built in, exceptions, templates, and a standard library built around those features. Everything else comes from C. For example, as you would have to manage memory in C, you have to manage memory in C++, unless you use "smart pointers" which are pointer-like template classes. Being that is the case, it is rather underwhelming that the standard (I'm referring to C++9x, the version you will probably learn to use yet) only provides one type of smart pointer -- auto_ptr. If you need a smart pointer that does something different than auto-ptr, you have to use a third party library or write the class yourself.
> and what would be better to learn?
It's basically a pain to learn either so it shouldn't matter where you start. I learned C++ first just because I found this place, and that's not a good reason.
If you've never programmed anything before, then you have a very different task: you must first learn how to program. Newbies are better suited to learn how to program on an interpreted language I think, because interpreted languages run all of the code on demand and there is no such thing as memory management. They do more with less coding time. Otherwise, as Mario puts it, "you have to inspect every dark corner of the language." Memory management should not be what programming is.
Or at least, learn how to program before we zealots tear you up discussing our opinions on what you should know.
Last edited by whiteflags; 11-04-2009 at 11:01 PM.
It will probably take me some time to figure everything out but I will start with getting a understanding of C. I found a website in my native language that discusses it and offers tutorials and assignments. And then move on to C++.
Thanks for all the answers from people here (read them all). But I think best for me is now to leave this topic for what it is before I end up with a brain injury from all the used terms.
I am also half-tempted to say that Java is not a modern language, simply because it is limiting and lacking in so many ways compared to C++.
Since you said "you" I will have to disagree. It absolutely depends on the way one thinks. If one thinks in a top down design, then one should use C. I personally have never grasped the idea of "do this to yourself" and am more of a control freak than that. This is also why my OS of choice is Slackware GNU/Linux in place of other flavors and MOST ESPECIALLY in place of Windows (though I use WinXP for gaming). I would much rather control my on fate than to leave it up to the language to handle that for me. I want control. I get it with C. I don't feel like I'm in control with C++.Originally Posted by Elysia
Which is why, as I stated before, it is asinine to say "C++ is better than C" or the other way around. I mean we may as well argue whether Chili is better than swimming. There is no comparison -- Chili is WAY better.
EDIT: "There is no comparison -- Chili is WAY better." would be ironic <=== Have to put this disclaimer in for some.
I have stated that C++ is more modern than C. I did not claim C++ is better than C. Obviously this is subjective.
Would it be easier for one with a programming background in .NET to start with C++? Yes, it would.
And obviously, the whole point of C++ is to give you the tools to get the work done in the fashion you want or require.
Oh, my bad. I equatedwith C++ is better than C as I take the phrases "more modern" and "do things faster" as implication of greater worth. Perhaps my understanding of these phrases does not coincide with the rest of the world.Originally Posted by Elysia
>If I got it right C# is basically meant for the Windows OS.
C# was designed with .NET in mind, and .NET was designed with Windows in mind. However, both C# and the foundation of .NET (CLI) are standardized such that they're not tied to Windows.
>But what are the differences exactly between C and C++
I think this question implies an intersection that one shouldn't assume without proficiency in both languages. The differences run deeper than language features, to the point where actual code in C has only a superficial similarity to actual code in C++. It's safer in the beginning to pretend that C and C++ are unrelated, yet have similar syntax for some fundamental features.
>what would be better to learn?
I wouldn't presume to tell you what you should learn, but I will say that I've never regretted learning C. I believe that a firm understanding of C and the challenges involved in writing software with C have helped make my C++ better. My advice is to learn the basics of one before learning the other, but ultimately learn both. Learning C and C++ at the same time (or any two languages as the same time) strikes me as an exercise in frustration.
My best code is written with the delete key.
Which is about as valid an argument as the most efficient OS kernels in the world being written in C and their mailing lists abhorring C++. That sector of the industry has made their choice for certain reasons, but it has absolutely no bearing on "which language is better", or "which I should learn" unless the person asking the question specifies a LOT more about what they want to do.OK, but seriously, there IS a reason why games are written in C++ and not C, right? Perhaps we should ponder about that.
>OK, but seriously, there IS a reason why games are written in
>C++ and not C, right? Perhaps we should ponder about that.
It's easier to organize large programs in C++ than C? Then again, it's probably just as hard to organize them well, so I suppose games are written by the lowest common denominator. The many critical bugs I encounter in the games I play is proof enough that game programmers are not as good as we'd like to believe.
In reality, I think the hype of OO kind of killed C as a viable option for most new software. It doesn't mean C++ is any better or worse, just that the current generation of developers has been trained to see OO as the single most important aspect of high quality software.
My best code is written with the delete key.