Thread: Advantages of using C first?

  1. #1
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283

    Question Advantages of using C first?

    I am curious on something...

    Is it a good idea to demostrate your C skills in applications before jumping into C++ applications? The gaming world is saying "go with C++" but I'm thinking a good C++ programmer probably knows and demostrated his C skills inside-out before adding OOP hooks.

    Some advantages I can think of:
    1) You can convert a C application into C++ aka applying OOP.
    2) Being restricted to the C subset for a particular project.
    3) Maintaining existing C applications.
    4) Training yourself to think low-level, aka one idea: writing your own code that outbeats an OOP version that gives better performance.
    5) Not freaking out when seeing low-level code.

    Anyway, thought I'd get your thoughts so I can confirm I'm not crazy. Thanks.

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Well if anything C++ is as its own creator says an extension of C (i.e. C with classes). So in order to understand the philosophy of C++ it certainly helps to understand C first. C++ adds useful stuff to the limitations of C, so I guess it's sort of like learning Italian after knowing Latin. It certainly isn't required but it might help along the way.

  3. #3
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    I'm actually learning Italian, did some Latin too. I prefer Italian I see your point though.

  4. #4
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    I found a C++ reference book that teaches the C subset first before jumping into C++. I think that is a good approach.

  5. #5
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    All I am saying is that most people that program in C++ also know C and usually have learnt it before learning C++. Even the name C++ is an ironic suggestion that C++ is "an increment from C". However, standard C is still used A LOT particularly in system development. C also teaches you a certain programming mentality that I personally found very useful in learning and approaching other programming languages. In a sense, if you want C teaches you to drive a bus, even if all you will ever drive is a car.

  6. #6
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    If you look at this, C is really up there close to Java:
    http://www.tiobe.com/content/paperinfo/tpci/index.html

    I suppose there's more use for C than C++? I see myself going into casual games.

  7. #7
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Well I wouldn't really consider that a standard statistic for anything really. Most stuff that works on Windows OS for example is typically written in C++. Most stuff that works on Linux as well as all kernel development is done in C. Both languages are extremely valuable! If you get to know both C and C++ well I can't really see any other language that you won't be able to catch up within a few days.

    These 2 are the languages I started with. I first learnt C from my father, who was systems engineer and then procedeed to learn C++ in college and when I got older. My pops still thinks C is the best haha, but that is understandable given his profession. Also, the man learnt to program in C when there were barely any personal computers around, so the man is something of a human compiler. )

  8. #8
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    Okay. If I'm going in games, I guess C++ is where my skill should be at. I do like how this book starts with the C subset though, then jumps into C++. I may not be able to apply C to applications after reading this book, but at least I'll know where C ends and C++ begins.

  9. #9
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    I remember the GBA was strictly C, but I guess games/compilers have moved forward since then.

  10. #10
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    It's just annoying game companies say they need a "C/C++" developer. Which one do they want? haha... I guess they are implying the "C with classes" approach.

    It's funny... I prefer C because its cleaner in my opinion, but I feel the push towards learning C++. I'll just learn what I can with both. Thanks.
    Last edited by dxfoo; 03-25-2010 at 10:54 PM.

  11. #11
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Companies saying C/C++ probably want both. As I said most C++ developers learnt C at some point before. C/C++ appears often enough especially with people that do not understand the actual difference between the two. They are both very useful languages to know nonetheless. C++ is backwards compatible with C so theoretically you can always run pure C code that will compile and run in C++.

  12. #12
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    I'll just read this book then. It's not a bad approach how it starts with C and then migrates into C++. Thanks.
    Last edited by dxfoo; 03-25-2010 at 11:16 PM.

  13. #13
    Registered User UltraKing227's Avatar
    Join Date
    Jan 2010
    Location
    USA, New york
    Posts
    123
    i never use C++, because i like the power of C. althrough, i know that the
    same power can be used by C++. but yet, i like to have limitations rather
    than none, because Limitations are the things which boost a programmer's
    knowledge.

  14. #14
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    I have moved this thread to General Discussions as it is not particularly about C programming per se, but a comparison that can be more broadly considered.

    Quote Originally Posted by dxfoo
    Is it a good idea to demostrate your C skills in applications before jumping into C++ applications?
    You might want to read Stroustrup's answer to the FAQ Knowing C is a prerequisite for learning C++, right?

    Quote Originally Posted by dxfoo
    The gaming world is saying "go with C++" but I'm thinking a good C++ programmer probably knows and demostrated his C skills inside-out before adding OOP hooks.
    A good C++ programmer should be rather good in C too. However, it is not a matter of demonstrating C skills and then "adding OOP hooks". C++ may have began as "C with classes", but trying to program in that way is not making good use of C++; C++ is not about adding some kind of OOP magic to a C program.

    Quote Originally Posted by dxfoo
    Some advantages I can think of:
    None of them are advantages of learning C before C++. They are just advantages of learning C and C++. (Actually, #2 and #3 are advantages of learning C, whether or not you learn C++. #5 depends on what you mean by "low level code".)

    Quote Originally Posted by dxfoo
    It's not a bad approach how it starts with C and then migrates into C++.
    I linked to an FAQ by Stroustrup; I suggest that you read the "Learning Standard C++ as a New Language" article that he links to in his answer. You are right to say that it may not be a bad approach, but it is not necessarily a good approach either.

    Quote Originally Posted by UltraKing227
    i like to have limitations rather
    than none, because Limitations are the things which boost a programmer's
    knowledge.
    There are limitations with all the tools that you use. You just have different limitations, so using your reasoning, your knowledge is just boosted in a different area.
    Last edited by laserlight; 03-26-2010 at 01:28 AM.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  15. #15
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Well, I just started with C++ after a few years of C and have heard quite a few opinions on the topic, so here's 2 cents.

    I think learning C for a while first is a good idea because you are less likely to go back and spend much time doing C programming once you get into C++. So if you start with C++, you will probably never do a serious project in C, and in that sense are unlikely to really learn about using it on a practical, serious level.

    So the question is whether learning to use C on a practical, serious level is of any value.

    This is sort of complicated by the fact that they are not really different languages; C++ essentially includes C, so it is a little illogical to say you will learn things writing in C that you cannot learn in C++.

    However, practically speaking, I think there are a lot of things that you will not learn, even though you could. In other words, if you are going to focus on the "C side" of C++ you might as well just deal with it directly. The more you are aware of, the more choices you have, and the more complete your understanding, etc.

    I don't think it would be a good situation to end up as a C++ programmer who shys away from C syntax because of a lack of competence and familiarity. If you are comfortable with, eg, both C and C++ string handling, then you are free to choose between them. If you are not, then your "choice" is pre-determined.

    Quote Originally Posted by dxfoo View Post
    4) Training yourself to think low-level, aka one idea: writing your own code that outbeats an OOP version that gives better performance.
    5) Not freaking out when seeing low-level code.
    Getting better performance with C may be chimeric; however, I do think there are some kernels of truth in these two points, so your thinking here is not completely off base. I might rephrase those two:

    4) understanding what can be done with structs and void pointers, not in the sense of simulating OOP, but in the sense of providing an alternative which may be more or less functional depending on the situation.
    5) learning to explicitly manage memory for yourself
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 09-24-2009, 01:28 AM
  2. advantages of using IDE
    By surrounded in forum C Programming
    Replies: 8
    Last Post: 03-03-2009, 06:36 AM
  3. Advantages of using macro for BIT positions
    By donmorr in forum C Programming
    Replies: 8
    Last Post: 07-23-2008, 06:15 AM
  4. advantages of tile-based engine...
    By o0obruceleeo0o in forum Game Programming
    Replies: 25
    Last Post: 07-22-2003, 08:03 AM