Advantages of C++ over C - request for information

Discussion in 'C++' started by Kamil Burzynski, Mar 7, 2005.

  1. Hello.

    I have to create short (1 hour) presentation about C++ advantages over
    C. Are there any good articles/texts/etc. about such topic?

    Personally, I'm quite proficient at C++ myself (e.g. I've read and
    understood many books from H. Sutter, A. Alexandrescu etc.), so I do not
    need to learn about C++ before making that presentation. I am able to
    write such presentation myself, but of course - if somebody else written
    similar text, I would like to use it.

    Thanks in advance for any ideas, comments and pointers to articles.

    --
    Best regards from
    Kamil Burzynski
     
    Kamil Burzynski, Mar 7, 2005
    #1
    1. Advertisements

  2. Kamil Burzynski wrote:
    > I have to create short (1 hour) presentation about C++ advantages over
    > C. Are there any good articles/texts/etc. about such topic?


    Have you tried the Web? www.google.com is a good starting point.

    > [...]
     
    Victor Bazarov, Mar 7, 2005
    #2
    1. Advertisements

  3. "Kamil Burzynski" <> wrote in message
    news:...

    > I have to create short (1 hour) presentation about C++ advantages over
    > C. Are there any good articles/texts/etc. about such topic?


    Take a look at chapter 1 of 'Ruminations on C++."

    Also, here's an example:

    map<string, int> words;
    string word;

    while (cin >> word)
    ++words[word];

    This code fragment counts how many times each distinct word appears in the
    standard input stream. You might try rewriting it in C and see how much
    more code it takes.
     
    Andrew Koenig, Mar 7, 2005
    #3
  4. On Mon, 07 Mar 2005 15:39:27 GMT
    "Andrew Koenig" <> wrote:

    > "Kamil Burzynski" <> wrote in message
    > news:...
    >
    > Take a look at chapter 1 of 'Ruminations on C++."
    >
    > Also, here's an example:
    >
    > map<string, int> words;
    > string word;
    >
    > while (cin >> word)
    > ++words[word];
    >
    > This code fragment counts how many times each distinct word appears in the
    > standard input stream. You might try rewriting it in C and see how much
    > more code it takes.


    Thanks a lot - great example! By the way: any similar example for type traits,
    some advanced template<> (i.e. something more than containers) snippets?

    --
    Best regards from
    Kamil Burzynski
     
    Kamil Burzynski, Mar 7, 2005
    #4
  5. On Mon, 07 Mar 2005 10:37:46 -0500
    Victor Bazarov <> wrote:

    > Kamil Burzynski wrote:
    > > I have to create short (1 hour) presentation about C++ advantages over
    > > C. Are there any good articles/texts/etc. about such topic?

    >
    > Have you tried the Web? www.google.com is a good starting point.


    Yes, I'm googling for this subject... for now I've end up with tons of
    C++ tutorials ;p I will keep going on, though.

    --
    Best regards from
    Kamil Burzynski
     
    Kamil Burzynski, Mar 7, 2005
    #5
  6. Kamil Burzynski

    Daniel Haude Guest

    On Mon, 7 Mar 2005 16:34:24 +0100,
    Kamil Burzynski <> wrote
    in Msg. <>

    > I have to create short (1 hour) presentation about C++ advantages over
    > C. Are there any good articles/texts/etc. about such topic?


    That's an odd topic. Any talk entitled "The advantages of A over B" sounds
    like a misguided attempt to sell product A to a customer who prefers B.
    But if this was the case it would be better to entitle the talk "On the
    differences between A and B", which of course would also unveil the
    advantages that B has over A.

    And 1 hour is by no means "short". What's the background of this question?
    Just curious.

    --Daniel
     
    Daniel Haude, Mar 7, 2005
    #6
  7. On 7 Mar 2005 16:20:12 GMT
    Daniel Haude <-hamburg.de> wrote:

    > On Mon, 7 Mar 2005 16:34:24 +0100,
    > > I have to create short (1 hour) presentation about C++ advantages over
    > > C. Are there any good articles/texts/etc. about such topic?

    >
    > That's an odd topic. Any talk entitled "The advantages of A over B" sounds
    > like a misguided attempt to sell product A to a customer who prefers B.
    > But if this was the case it would be better to entitle the talk "On the
    > differences between A and B", which of course would also unveil the
    > advantages that B has over A.


    Good point. This situation is slightly similar, however :) Take a look
    below for more explaination.

    > And 1 hour is by no means "short". What's the background of this question?
    > Just curious.


    Well, lets say, that "long" is few days - 8h each ;)

    There is many C programmers, that do avoid C++ just because "it is too
    bloated, C++ are bigger and slower, I can use struct instead of class and have
    rougly the same functionality, etc.". I would like to show, that C++
    is not necessarily overbloated, and it have many useful mechanisms, that
    are improving programmers efficiency on long-term project development.

    --
    Best regards from
    Kamil Burzynski
     
    Kamil Burzynski, Mar 7, 2005
    #7
  8. Kamil Burzynski

    Noah Roberts Guest

    Kamil Burzynski wrote:
    > Hello.
    >
    > I have to create short (1 hour) presentation about C++ advantages

    over
    > C. Are there any good articles/texts/etc. about such topic?


    Don't forget to mention that C++ is C with two plusses...
     
    Noah Roberts, Mar 7, 2005
    #8
  9. Noah Roberts wrote:
    > Kamil Burzynski wrote:
    >
    >>Hello.
    >>
    >> I have to create short (1 hour) presentation about C++ advantages

    >
    > over
    >
    >>C. Are there any good articles/texts/etc. about such topic?

    >
    >
    > Don't forget to mention that C++ is C with two plusses...
    >


    Why is that an advantage? Takes almost 200% longer to type...
     
    Victor Bazarov, Mar 7, 2005
    #9
  10. Kamil Burzynski

    osmium Guest

    "Kamil Burzynski" writes:

    > I have to create short (1 hour) presentation about C++ advantages over
    > C. Are there any good articles/texts/etc. about such topic?
    >
    > Personally, I'm quite proficient at C++ myself (e.g. I've read and
    > understood many books from H. Sutter, A. Alexandrescu etc.), so I do not
    > need to learn about C++ before making that presentation. I am able to
    > write such presentation myself, but of course - if somebody else written
    > similar text, I would like to use it.
    >
    > Thanks in advance for any ideas, comments and pointers to articles.


    Try Bjarne Stroustup's site:

    http://www.research.att.com/~bs/C++.html

    I haven't looked but there must be some good stuff there. I know he has a
    good list of advantages in the Second Edition of _The C++ Programming
    Language_.
     
    osmium, Mar 7, 2005
    #10
  11. Kamil Burzynski

    Amit Pansare Guest

    Kamil Burzynski wrote:
    > Hello.
    >
    > I have to create short (1 hour) presentation about C++ advantages over
    > C. Are there any good articles/texts/etc. about such topic?
    >
    > Personally, I'm quite proficient at C++ myself (e.g. I've read and
    > understood many books from H. Sutter, A. Alexandrescu etc.), so I do not
    > need to learn about C++ before making that presentation. I am able to
    > write such presentation myself, but of course - if somebody else written
    > similar text, I would like to use it.
    >
    > Thanks in advance for any ideas, comments and pointers to articles.
    >

    1> new /delete vs malloc?
    2> inline constructors and destructors for better performance?
    3> How do we acccess struct data? Using some array indexing -- so isn't
    that overhead?
    4> What about locality of reference in c++ isnt it much better?

    You can talk about these points as well.
     
    Amit Pansare, Mar 8, 2005
    #11
  12. Kamil Burzynski

    Phil Staite Guest

    Kamil Burzynski wrote:
    > There is many C programmers, that do avoid C++ just because "it is too
    > bloated, C++ are bigger and slower, I can use struct instead of class and have
    > rougly the same functionality, etc.". I would like to show, that C++
    > is not necessarily overbloated, and it have many useful mechanisms, that
    > are improving programmers efficiency on long-term project development.


    If you're trying to sell/promote/discuss C++ rationally with a bunch of
    die-hard C programmers (I oughta know, I used to be one many years ago)...

    Then maybe they are already thinking object-oriented, packaging data up
    in structs and writing functions to work with structs. (ie. almost like
    member functions) You could point out:

    C++ increases type safety, particularly with new, delete, collection
    classes and stream IO. This enables you to catch some errors at compile
    time rather than debugger time.

    C++ provides automated "plumbing" for doing what they are already doing
    "by hand." If they are thinking/coding object oriented (yes you can do
    that in C) then using an OO language just makes life easier.

    C++ provides virtual functions, something not easily done in raw C. (yes
    I know you can. But hey, I can whittle a rocking chair with nothing
    more than a pocket knife too, but why would anyone want to?)

    C++ gives you the STL, letting you "stand on the shoulders of giants" -
    or at least not have to re-invent fundamental data structures and
    algorithms.

    C++ provides an exception mechanism for structured error handling.

    C++ is not nearly as big and bloated as many C die-hards (and assembly
    programmers) would have us believe. Can you hurt yourself (and
    performance) with C++? Sure. But you can also write code that is every
    bit as efficient as C. When people complain that C++ is big and
    bloated, it often means that their understanding of the problem and how
    best to apply OO/C++ to it is anemic.

    Finally, they don't have to try to go whole-hog into C++ from day one.
    They can start out simply using C++ as a better C. Then begin applying
    C++ idioms as appropriate.
     
    Phil Staite, Mar 8, 2005
    #12
  13. Phil Staite wrote:
    > Kamil Burzynski wrote:

    ....
    > C++ is not nearly as big and bloated as many C die-hards (and assembly
    > programmers) would have us believe. Can you hurt yourself (and
    > performance) with C++? Sure. But you can also write code that is every
    > bit as efficient as C.


    Translation: "I can write bad code in any language."


    When people complain that C++ is big and
    > bloated, it often means that their understanding of the problem and how
    > best to apply OO/C++ to it is anemic.
    >
    > Finally, they don't have to try to go whole-hog into C++ from day one.
    > They can start out simply using C++ as a better C. Then begin applying
    > C++ idioms as appropriate.


    I'm not sure this is appropriate (after having done just that)!

    I would rather introduce tools like smart pointers, policy classes etc
    right up front. The learning curve will be shorter (hopefully).
     
    Gianni Mariani, Mar 8, 2005
    #13
  14. Kamil Burzynski

    Guest

    I hear this is the approach "Accelerated C++" takes, though I havent'
    seen this book myself. (I wish I had heard of it it 7 years or so ago
    though, if it was around then.)

    I'm actually "writing" (when I have the time, which is essentially
    never) what will be a full-fledged book I'm going to put online that
    takes this approach too.
     
    , Mar 8, 2005
    #14
  15. Kamil Burzynski

    Taras Guest

    On Mon, 07 Mar 2005 12:07:03 -0500, Victor Bazarov
    <> wrote:

    > Noah Roberts wrote:
    >> Kamil Burzynski wrote:
    >>
    >>> Hello.
    >>>
    >>> I have to create short (1 hour) presentation about C++ advantages

    >> over
    >>
    >>> C. Are there any good articles/texts/etc. about such topic?

    >> Don't forget to mention that C++ is C with two plusses...
    >>

    >
    > Why is that an advantage? Takes almost 200% longer to type...



    All the things you are writing in C++ can be written in C.
    Advantage of C++ is that you can do it faster, with less
    errors and so on. This is starting point to all other
    explanations. Otherwise you will always get answer
    "I can do it in my beloved C".
     
    Taras, Mar 8, 2005
    #15
  16. Kamil Burzynski

    Daniel Haude Guest

    On Tue, 08 Mar 2005 10:43:35 +0200,
    Taras <> wrote
    in Msg. <>

    > All the things you are writing in C++ can be written in C.
    > Advantage of C++ is that you can do it faster, with less
    > errors and so on.


    Depends very much on the application though. I learned C++ when I was
    faced with a problem that was so compulsively object-oriented that
    learning the new language and implementing the application was a lot
    faster than it would have been in C. In fact I didn't have to work very
    hard because I had negotiated for a very convenient deadline (thinking I
    would use C. In C++, I had the parts of the app ready long before the
    respective deadlines, but released them only shortly before, thus building
    up quite a reputation ;-). So I ended up getting paid quite handsomely for
    learning a new language.

    I still like C a lot better, aesthetically. Ever wondered why there isn't
    an obfuscated C++ contest? ;-)

    --Daniel
     
    Daniel Haude, Mar 8, 2005
    #16
  17. C++ is a superset of C.

    I dont know why I feel that needs explination, but:

    C is part of C++, C++ is C and the ++.

    Why is package A and B better or worse than just package A?

    Well with package A and B you get all of the stuff in package A and all of
    the stuff in package B. But in package A, you don't get any B stuff.

    Thats why package A and package B is better.

    C++ has one major disadvantage, that is coupled with its major advantage.
    Speed and size versus Power.

    You can write more powerfull programs quicker with c++. And as a result, it
    will be a bigger and slower programm than doing the same thing in C alone.
    If you want to take the time, and I mean sometimes close to 5 times the
    coding to do the same thing in C, go for it.

    BUT, just becuase you are using C++ doesn't mean you can no longer put C
    code in your program.
    Use a healthy mixture of both to pull the Power, AND Performance out of
    you're computer.


    "Daniel Haude" <-hamburg.de> wrote in message
    news:-hamburg.de...
    > On Tue, 08 Mar 2005 10:43:35 +0200,
    > Taras <> wrote
    > in Msg. <>
    >
    >> All the things you are writing in C++ can be written in C.
    >> Advantage of C++ is that you can do it faster, with less
    >> errors and so on.

    >
    > Depends very much on the application though. I learned C++ when I was
    > faced with a problem that was so compulsively object-oriented that
    > learning the new language and implementing the application was a lot
    > faster than it would have been in C. In fact I didn't have to work very
    > hard because I had negotiated for a very convenient deadline (thinking I
    > would use C. In C++, I had the parts of the app ready long before the
    > respective deadlines, but released them only shortly before, thus building
    > up quite a reputation ;-). So I ended up getting paid quite handsomely for
    > learning a new language.
    >
    > I still like C a lot better, aesthetically. Ever wondered why there isn't
    > an obfuscated C++ contest? ;-)
    >
    > --Daniel
     
    DHOLLINGSWORTH2, Mar 9, 2005
    #17
  18. In message <TnyXd.1054$Qz.789@okepread05>, DHOLLINGSWORTH2
    <> writes

    >C++ is a superset of C.
    >
    >I dont know why I feel that needs explination, but:


    Because it's not true?

    --
    Richard Herring
     
    Richard Herring, Mar 9, 2005
    #18
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Dalberg
    Replies:
    4
    Views:
    661
    Karl Seguin
    Dec 8, 2005
  2. Sally Thompson
    Replies:
    10
    Views:
    6,349
    Sally Thompson
    Jun 26, 2004
  3. 79

    JMX advantages over RMI

    79, May 1, 2006, in forum: Java
    Replies:
    3
    Views:
    2,662
    Daniel Dyer
    May 2, 2006
  4. utab
    Replies:
    3
    Views:
    980
  5. Smokey Grindle

    advantages of State Server over InProc server

    Smokey Grindle, May 7, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    478
    Eliyahu Goldin
    May 7, 2007
Loading...

Share This Page