Thread: Why use C when you can use C++?

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    6

    Question Why use C when you can use C++?

    I was just wondering why people use C when they can use C++? Does C have any advanteges? C programs are a little smaller then C++ right?

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    the speed differences can most always be attributed to incorrect use of C++. However, there is nothing wrong with using C as there is nothing wrong with using assembler/pascal/basic/fortran/cobol/ada/etc... So the question of "why use C" is silly and pointless. Why call yourself Dixon?
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Registered User
    Join Date
    Nov 2003
    Posts
    6

    Name

    Franklin W.DIXON the ghost name for the authers that wrote the Hardy Boys books.

  4. #4
    Registered User
    Join Date
    Jun 2003
    Location
    Austria
    Posts
    55
    As Jacob Navia (developer of the lcc-win32 compiler) wrote in a (great) C-Tutorial:


    C has been widely criticized, and many people are quick to show its problems and drawbacks. But as languages come and go, C stands untouched. The code of lcc-win32 has software that was written many years ago, by many people, among others by Dennis Ritchie, the creator of the language itself. The answer to this question is very simple: if you write software that is going to stay for some time, do not learn "the language of the day"; learn C.

    C doesn’t impose you any point of view. It is not object oriented, but you can do object oriented programming in C if you wish. It is not a functional language but you can do functional programming with it if you feel like. Most LISP interpreters and Scheme interpreters/compilers are written in C. You can do list processing in C, surely not so easily like in lisp, but you can do it. It has all essential features of a general purpose programming language like recursion, procedures as first class data types, and many others that this tutorial will show you.

    Many people feel that C lacks the simplicity of Java, or the sophistication of C++ with its templates and other goodies. True. C is a simple language, without any frills. But it is precisely this lack of features that makes C adapted as a first time introduction into a complex high-level language that allows you fine control over what your program is doing without any hidden features. The compiler will not do anything else than what you told it to do. The language remains transparent, even if some features from Java like the garbage collection are incorporated into the implementation of C you are going to use.

    As languages come and go, C remains. It was at the heart of the UNIX operating system development in the seventies, it was at the heart of the microcomputer revolution in the eighties, and as C++, Delphi, Java, and many others came and faded, C remained, true to its own nature.

  5. #5
    Some of that is stupid, I won't get into that in this thread though.

    C is more widely used in embedded programming. It can sometimes be simpler to make a platform that uses C than C++, because some of the extra overhead.

    I think it's mainly just preference. Go to a VB programmer and tell them that VB sucks and they'll argue.

  6. #6
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    Many people believe that OS development (kernel writing in particular) is easier in C. Frenchfry already touched on embedded programming, i've done some of that myself. I'd say if you're writing something else, C++ is in my opinion the way to go, both languages are just as powerful, but I think the way C++ handles things makes it easier to do many things.

    BTW fry I didn't htink any of that quote was stupid, I thought it illustrated the point very clearly and truthfully.
    PHP and XML
    Let's talk about SAX

  7. #7
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    screw C, and screw C++! Use Quake-C!

  8. #8
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    >>Quake-C

    ::give silver a confused look::
    PHP and XML
    Let's talk about SAX

  9. #9
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    custom programming language.

    guess what game used it.

  10. #10
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    DarkBASIC ownz j00 all!!!
    Last edited by Prelude; 11-10-2003 at 10:39 PM.
    My best code is written with the delete key.

  11. #11
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    1) who are you and what have you done with Prelude
    2) Evidently only the 'game logic' was written in Quake C

    EDIT: and don't worry prelude, I took a screenshot

  12. #12
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    The edit has been removed for better screenshots.
    My best code is written with the delete key.

  13. #13
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    we're ruining this poor man's thread.

  14. #14
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    It has happened before. But, to answer the actual question instead of spewing flame-bait and confusion: I prefer C because the language as a whole is cleaner and less awkward. I can't speak for C++ as a whole because only a handful of people know it thoroughly and I'm not one of them. Which is another reason I prefer C. According to extensive research of my habits and knowledge base (which involved inventing suitably shocking percentages that made my point without having to do actual work), I can remember and use 98% of C on a regular basis, but I doubt I even know more than 30% of C++, and I use about 5% regularly.
    My best code is written with the delete key.

  15. #15
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    that and templates are just plain silly. void* is the way to go baby.

    yes I said baby

Popular pages Recent additions subscribe to a feed