Re: Advantages of C++ over C - request for information

From: Phil Staite (phil_at_nospam.com)
Date: 03/08/05


Date: Mon, 07 Mar 2005 21:57:57 -0700
To: Kamil Burzynski <K.Burzynski@usunto.adbglobal.com>

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.



Relevant Pages

  • Re: Naming structs with a variable
    ... remember that structs are value types in .NET. ... reference semantics) should be the default choice. ... I said that there were two reasons. ... Experienced .NET programmers with a firm grasp of value semantics ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Antenna programming tool/language/compiler/preprocessor?
    ... The comments in source are only meant for other programmers, they already know how to program, you don't have to teach 'em, nor attempt to ... With the proper use of significant names for variables, structs, defines, etc. and programming for a "logical flow" of code, few comments are needed (approx. ... // call at any point to debug/check variables ... float coil_self-capacitance_pf, ...
    (rec.radio.amateur.antenna)
  • Re: unionists versus separatists
    ... > Or will the race of C programmers eventually die out? ... I thought you were going to talk about unions v structs (a union ... Well, I like structs! ...
    (comp.lang.c)
  • Re: Unnamed members
    ... 'real' C programmers?" ... there are three C compilers in play here at this time, ... behavior of structs and unions in this case, as unnamed unions are ... and structs not, well, then I'm curious as to why, but this may not be ...
    (comp.lang.c)