C or C++

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 ...

  1. #16
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by Elysia View Post
    Learning both languages is silly.
    C/C++ are merely different aspects of the same language. You can write a real world application without C++, but you cannot write a real world application without C. Learn both.

  2. #17
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    you cannot write a real world application without C
    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.

  3. #18
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    >> 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.

  4. #19
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    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.

    Quote Originally Posted by sean View Post
    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.
    Perhaps he means without C API calls? Still, I fail to see how you need C to write a real-world application?
    Last edited by zacs7; 11-04-2009 at 05:06 PM.

  5. #20
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    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.

  6. #21
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,627
    > 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.

  7. #22
    Learning C. JOZZY& Wakko's Avatar
    Join Date
    Nov 2009
    Posts
    59
    Quote Originally Posted by whiteflags View Post
    Or at least, learn how to program before we zealots tear you up discussing our opinions on what you should know.
    I think that is a good idea. I did some basic work before in Python and VB.NET and have some experience in web application development but this here is all new to me.

    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.

  8. #23
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,422
    Quote Originally Posted by JOZZY& Wakko View Post
    I think that is a good idea. I did some basic work before in Python and VB.NET and have some experience in web application development but this here is all new to me.

    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.
    That is just the thing - learning C before C++ is silly. C++ is completely different. Yes, it has some C aspects that you are going to have to learn, so you will learn C. However, C++ does things in a completely different way, and with a different way of thinking, so learning C first will not only be painful, it will also hinder your intake of C. Once again, they are two different languages. Learn one, not both, preferably.

    Quote Originally Posted by abachler View Post
    C/C++ are merely different aspects of the same language. You can write a real world application without C++, but you cannot write a real world application without C. Learn both.
    Quote Originally Posted by zacs7 View Post
    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.
    I think Daved nailed this one:
    Quote Originally Posted by Daved View Post
    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.
    It means do not learn C. Learn C++ with its C parts. It is a good idea to be able to implement lower level code.


    Quote Originally Posted by zacs7 View Post
    @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.

    Perhaps he means without C API calls? Still, I fail to see how you need C to write a real-world application?
    OOP is not C++'s only feature. But the point is that I would call C++ more modern because it allows us to do things faster and easier than C, while still allowing to do things the low-level complicated way, aka C. OOP and other things are also modern things that modern languages feature simply because they have proven to be useful in situations. Why then not allow us to take advantage of this? Why should we be limited?
    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++.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #24
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Quote Originally Posted by Elysia
    OOP is not C++'s only feature. But the point is that I would call C++ more modern because it allows us to do things faster and easier than C, while still allowing to do things the low-level complicated way, aka C. OOP and other things are also modern things that modern languages feature simply because they have proven to be useful in situations. Why then not allow us to take advantage of this? Why should we be limited?
    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++.

    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.

  10. #25
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,422
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #26
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Oh, my bad. I equated
    Quote Originally Posted by Elysia
    I would call C++ more modern because it allows us to do things faster and easier than C
    with 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.

  12. #27
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >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.

  13. #28
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,422
    Quote Originally Posted by Kennedy View Post
    Oh, my bad. I equated with 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.
    OK, but seriously, there IS a reason why games are written in C++ and not C, right? Perhaps we should ponder about that.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #29
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    OK, but seriously, there IS a reason why games are written in C++ and not C, right? Perhaps we should ponder about that.
    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.

  15. #30
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >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.

Page 2 of 5 FirstFirst 12345 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21