Why do you program in C++?

148 views
Skip to first unread message

Scott Meyers

unread,
Apr 18, 2005, 5:08:51 AM4/18/05
to
In my experience, C++ is alive and well -- thriving, even. This surprises
many people. It is not uncommon for me to be asked, essentially, why
somebody would choose to program in C++ instead of in a simpler language
with more extensive "standard" library support, e.g., Java or C#. I can
think of several reasons why one might choose C++, but I can also think of
several reasons why one might choose a different language. Here, I'm not
interested in why one MIGHT choose C++, I'm interested in why people DO
choose C++. If you're reading this newsgroup, you presumably use C++,
possibly in addition to other languages. I'd be very interested to know
why you choose C++ over languages like Java and C#. My goal here is not to
start a C++ love-fest, nor is my goal to get people to dump on other
languages. It's a truly neutral question: given that there are many
languages to choose from, why do you choose to program in C++? I don't
care if the reaons are technical, political, social, or what, I'm just
honestly curious.

Thanks very much to everyone -- and I hope there will be many -- who
participates in this thread.

Scott

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Dmitry Mityugov

unread,
Apr 18, 2005, 7:08:06 AM4/18/05
to
Scott Meyers wrote:
...

> languages to choose from, why do you choose to program in C++? I don't
> care if the reaons are technical, political, social, or what, I'm just
> honestly curious.
...

Just because C++ was the first widely used object-oriented language, or at
least the first object-oriented language widely used by me. Advantages of
other object-oriented languages are not enough to me to switch to them.

Dmitry

David

unread,
Apr 18, 2005, 9:50:57 AM4/18/05
to
Hello Scott,

On Mon, 18 Apr 2005 09:08:51 UTC, Scott Meyers <Use...@aristeia.com>
wrote:

> In my experience, C++ is alive and well -- thriving, even. This
> surprises
> many people. It is not uncommon for me to be asked, essentially, why
> somebody would choose to program in C++ instead of in a simpler
> language
> with more extensive "standard" library support, e.g., Java or C#. I
> can

Developers should be able to choose their tools. A great many
projects
can be implemented in any language, with any development tools, and on
nearly any operating system.

Given the list of C++, Java, and C# how do they compare? They were
developed in roughly that order. They are perhaps also listed in order
of increasing support complexity. We don't all need our initial
toolsets
to include every conceivable method we might ever need. We might want
to have some of that responsibility for ourselves.

My personal choice was C++ because it existed. There were other
choices
too, and I learned and used many of them. Java requires extra support
mechanisms that some of my devices do not have. A shared code base is
therefore a problem. C# isn't widely supported and is available on only
one of the fourteen machines that I develop for.


> think of several reasons why one might choose C++, but I can also
> think of
> several reasons why one might choose a different language. Here, I'm
> not
> interested in why one MIGHT choose C++, I'm interested in why people DO
> choose C++. If you're reading this newsgroup, you presumably use C++,
> possibly in addition to other languages. I'd be very interested to
> know
> why you choose C++ over languages like Java and C#. My goal here is
> not to
> start a C++ love-fest, nor is my goal to get people to dump on other
> languages. It's a truly neutral question: given that there are many
> languages to choose from, why do you choose to program in C++? I don't
> care if the reaons are technical, political, social, or what, I'm just
> honestly curious.

If I were starting development today and could only choose from your
stated languages C++ would probably win out. Java would be a close
second. If my education was more Microsoft-oriented C# might have
made more sense.

By "Microsoft-oriented" I mean as a language they support and
encourage.
Those of us who have been around for any length of time have seen many
generations of tools. New is not always better, though it can be.
Still, if my philosophy was to embrace every new tool that came along
every project I've worked on would have been with different tools.
Most of them have. However, to change all my tools with every project
would create a massive education curve and probably not much of an
increase in capability.

My concern over the tool debates is that they occur at all. As stated
earlier, these tools have different goals and development timelines.
Of more concern should be what we intend to do with them. Some projects
are easier with given toolset. Sometimes the toolset is used to
generate more tools. Porting to a new toolset base therefore has a
higher
cost, which may or may not be worth the effort.

Many years ago such decisions were left to those that had the
technical
know how to weigh the costs of their decisions. Now there are more
tools
and a few more developers, but the decisions are not often made by the
same knowledgeable people. The developers are no longer in charge.
Often
the customer or the general public has some say in the matter. That has
ramifications that deserve its own thread.

> Thanks very much to everyone -- and I hope there will be many -- who
> participates in this thread.
>
> Scott

Thank you for starting a nice thread for this week,

David

R.F. Pels

unread,
Apr 18, 2005, 9:44:12 AM4/18/05
to
Scott Meyers wrote:

> It's a truly neutral question: given that there are many
> languages to choose from, why do you choose to program in C++?

Because I sort of stumbled over it in the process of learning to
program.
And yes, I do use other languages. By choice too. Java for example. And
I
recently started looking a bit at OCAML. Then again, I also started
tinkering in KDE/Qt, which is C++ also.

But the main reason for using C++ and similar languages is that it is
quite
rich in the possibilities of expressing ideas and to me C++ has some
sort
of natural ability to keep constituent parts of a program small. And
last-but-not-least, I think OO languages fit my type of reasoning or
looking at problems better than other types of languages.

--
Ruurd
.o.
..o
ooo

Nemanja Trifunovic

unread,
Apr 18, 2005, 11:06:38 AM4/18/05
to
> why
> somebody would choose to program in C++ instead of in a simpler
language
> with more extensive "standard" library support, e.g., Java or C#

I would distinguish between "simple to learn" and "simple to use".
While C++ is not simple to learn, I find many programming tasks being
much simpler to perform in C++ than in abovementioned "simple"
languages.

And to answer the original question: I use C++ simply because I have
not found anything better so far (not that i haven't used other
languages - including Java and C#). Give me a language with C++
semantics, Pascal-ish syntax, abundance of available libraries, and to
be popular among employers as well - I will switch to it. In the
meantime, C++ does the job just fine.

Victor Bazarov

unread,
Apr 18, 2005, 11:07:40 AM4/18/05
to
Scott Meyers wrote:
> [...] I'd be very interested to know
> why you choose C++ over languages like Java and C#.[...]

Our reason is very simple: our company has several products, originally
written in C, and at some point they'd grown enough to need to involve
more people, compartmentalize, componentize even further, abstract,
generalize, and the natural way to comply with all those requirements
and still use the existing code and people was to progress to C++.

Besides, we support more than a dozen of platforms (with the same code,
essentially), so portability is essential. Also, our applications have
to be fast. Need I say more? :-)

V

Randy

unread,
Apr 18, 2005, 11:08:39 AM4/18/05
to

Scott Meyers wrote:

[snip]

> given that there are many
> languages to choose from, why do you choose to program in C++?

[snip]

>
> Scott
>
>
>

Because C++ supports enough programming styles/paradigms that it allows
me to do my work in the way most natural for the problem at hand. Plus
I like the stronger type safety coupled with low-level stuff when
needed.

Basically, C++ lets me program the way I want, without getting in my
way, while still protecting me from screwing up too badly in most
cases.

What more could you ask for in a programming language?

Randy.

Sergei Organov

unread,
Apr 18, 2005, 11:16:22 AM4/18/05
to
Scott Meyers <Use...@aristeia.com> writes:
> In my experience, C++ is alive and well -- thriving, even. This surprises
> many people. It is not uncommon for me to be asked, essentially, why
> somebody would choose to program in C++ instead of in a simpler language
> with more extensive "standard" library support, e.g., Java or C#.

Well, in the field I work most of time, real-time applications for
embedded targets, C++ seems to be the only reasonable choice from the
above mentioned languages. C is used as well, but C++ for me is
definitely more pleasant to work with.

So, the answer is: because from the mainstream languages that support OO
and generic programming, C++ is most efficient from the point of view of
resulting program code size and execution time. Predictable execution
time is also a strict requirement, so non-optional GC is not an option.

When I need to do something for ordinary computer, I either use C++
because I know it best and can reuse the code written for embedded
targets and vise versa, or Python due to its simplicity and power (I've
been able to write my first program in it in about a day, -- even in C++
that I use every day it would take me more time, I think). Sometimes I
use Tcl/Expect as well.

As for Java and C#, I didn't actually use either of them as I don't
believe they could beat, e.g., Python, in usage simplicity. I'm afraid
their wide-spreading is mostly due to the marketing issues behind them,
not due to their outstanding simplicity, power, or portability, sorry.

--
Sergei.

Emil Kirichev

unread,
Apr 19, 2005, 5:53:07 PM4/19/05
to
I use it for 2 reasons:
1. freedom. c++ gives me the freedom to apply various techniques
2. the pleasure while coding c++, and seeing the end result
(preferably positive result :) )

Nicola Musatti

unread,
Apr 19, 2005, 5:54:28 PM4/19/05
to
I program in C++ because, when the project I'm working on was started,
someone decided it was to be done in C++. Now, six years, eight
releases, over a hundred screens and well over half a million lines of
code later (and with the original decision maker long gone elsewhere)
I'm convinced that this was the right choice.

In my view, for a rather traditional, three layer (DB, Model, GUI)
application like the one we're developing, C++ strikes a positive
balance of three features: its expressiveness, in conjunction with its
support for type safety, is helpful in modelling the intricacies of the
domain we deal with; its being a traditional, fully compiled, light
runtime language gives us good performance without requiring that we
spend lots of time in tuning; and its popularity makes it not too
difficult to find staff.

The real question, however, is: why did I stay this long? There are
other considerations obviously, but one of the main reasons is this is
the only project I came across in which I could program in C++.

C++ is my favourite programming language. I find that it better suits
my way of thinking than any other language I ever programmed in or read
about. This probably has to do with its being the statically typed
language that better supports the combination of object oriented and
generic programming, which in turn makes it possible to translate into
code with very high precision the variabilities and commonalities of
the application domain, in the sense described by Jim Coplien in
"Multi-Paradigm Design for C++".

Moreover, C++ allows me to do it with very little redundancy, that is I
find that I'm very seldom forced to code the same conceptual operation
more than once. This is not only a question of efficiency (i.e.
laziness :-) but also and again, a matter of implementing the model
that best fits the problem domain.

People arguing that there's a single or a set of appropriate languages
for each project are probably right, but they often fail to take into
account that people are not language neutral; their knowledge,
experience and way of thinking influences their productivity in
different languages. I'm convinced I'd still be more productive in C++
than in any other language I know about, even if I got a chance of
acquiring the same degree of experience.

Cheers,
Nicola Musatti

P.S. Now, if I only started writing *about* C++, instead of *in* C++, I
might stand a better chance of becoming the next Scott Meyers :-)

Fernando Cacciola

unread,
Apr 19, 2005, 5:55:15 PM4/19/05
to
I had been programming in C++ for more than a decade, and in C# for some
more than a year.
I've never seriously programmed in Java

I choose C++ over C# because:

* It has multiple inheritance. (Please, spare me the OO purisim, lack of MI
_is_ annoying)
* It better supports multiparadigm programming (functional,
aspect-oriented, etc)
* It has static templates (instead of Generics)
* It supports metaprogramming
* It better supports low-level performance-controlled programming.

* Finally: All of the above allows the language to base outstanding
libraries that IMHO exceed by far their counterparts in any other language.

Having said that, I would like to mention the few things I miss in C++ from
C#.

* Stricter type system
* Built-in interfaces
* Built-in GC
* Reflexion (and Attributes)

Now of course most of that would be merged into the C++/CLR.

Fernando Cacciola

Junker

unread,
Apr 19, 2005, 5:57:18 PM4/19/05
to
Scott Meyers <Use...@aristeia.com> wrote in message news:<MPG.1cccf8dfd...@news.hevanet.com>...

I work for a games company that uses C++ for performance reasons as
well as for compatibility reasons with legacy codebases developed
predominantly in C. Traditionally tools here have been developed using
MFC, but the newer tools in the company are being developed with the
.NET languages, with C# being a popular choice.

Russell Hind

unread,
Apr 19, 2005, 5:53:48 PM4/19/05
to
Scott Meyers wrote:
>
> Thanks very much to everyone -- and I hope there will be many -- who
> participates in this thread.
>

One big reason I like C++ is type-safety at compile-time. I've only
played with java, c# and objective-c, but none of them give the same
checking at compile time.

The second big reason is the determinism of C++. For stack-based
objects you know when constructors/destructors will be called (compiler
bugs aside :) ) etc. This is another big plus for me.

Aside from that, as others have mentioned, some of the libraries now
available for C++ are very interesting. boost::spirit and boost::lambda
are two examples uses of the language I'd never have imagined a few
years ago (now if only our main compiler could cope with them ...)

Cheers

Russell

HappyHippy

unread,
Apr 19, 2005, 5:58:45 PM4/19/05
to

"Scott Meyers" <Use...@aristeia.com> wrote in message
news:MPG.1cccf8dfd...@news.hevanet.com...

I'll be brief: C++ is the best! :)

jto...@yahoo.com

unread,
Apr 19, 2005, 5:58:00 PM4/19/05
to

Just because C++ is a continuous challenge. When you think you know
everything -- then pops a new library or article, or so, showing you
something you never thought would be possible: may that be (techniques
described in) "Modern C++ Design", MPL, boost::bind, and so on.
(p.s. -- efficiency is not a major concern for me)

Best,
John


--
John Torjo, Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/ -v1.6.3 (Resource Splitter)
-- http://www.torjo.com/cb/ - Click, Build, Run!

harry_bosch

unread,
Apr 19, 2005, 6:06:16 PM4/19/05
to
Scott Meyers <Use...@aristeia.com> wrote:

> Thanks very much to everyone -- and I hope there will be many -- who
> participates in this thread.

Because there isn't anything "better", although I wish there was. And yes,
"better" needs to be defined:

1) Performant code, when I need it. Not the strongest reason, but C++
allows me to optimize how and when I wish, something I cannot do as easily
with Java or C#. IMO, this advantage is highly overrated but when you need
it, nothing else will do.

2) Native compilation. I don't want to release my source code, so neither
Java nor C# have an advantage. And cross-platform is not important to me,
so Java has no advantage on that point either (I don't consider C# cross-
platform, desite Mono, etc.).

3) Tool support. Weakest of the reasons, because C++ lags far behind Java
and C# in this area, despite having been around far longer. But this also
keeps me with C++ instead of jumping ship to a new language such as D,
which has little or no tool support. If D had better tools, I'd switch with
very little hesitation.

4) Library support. Again, Java and C# are more appealing, but D is not.
C++ at least has boost and various GUI libraries, etc.

5) Industry support. There are plenty of books, forums, and web sites
devoted to C++, so when problems arise, help can be found. For my needs,
C++, Java and C# rate about equal here, but D is less attractive.

6) Familiarity. I've programmed in C++ since v1.0, and in C before that.

If it weren't for #2, Native compilation, I'd probably switch to C#. I like
C++ less and less with each passing year.

--
harry

Bronek Kozicki

unread,
Apr 19, 2005, 6:18:22 PM4/19/05
to
Scott Meyers wrote:
> languages. It's a truly neutral question: given that there are many
> languages to choose from, why do you choose to program in C++? I don't

Because it allows me to move large parts of program verification from
runtime (that is Java or .NET approach) to compiler. Failed compilation
of incorrect program is much better than running it and waiting to fail.


B.

Andy

unread,
Apr 19, 2005, 6:29:36 PM4/19/05
to
Hello Scott,

I guess the reasons for working in C++ were circumstantial - it was the
only programming language I knew in college. And it was the primary
language I later used in my job. However the reasons for choosing it
are not merely circumstantial. I was once asked to work on a GUI Forms
toolkit for which you write business logic in stored procs and triggers
(could not create a shorter allusion) and I gave up in 2 days.

I have had occasion to work on Java and a bit on C# in the .NET
environment. I did not necessarily find them simpler to learn - I might
be biased - but I did not. For me, the primary appeal of C++ is its
minimalism. I think it exposes a vast open-ended set of possibilities
through a truly minimalist set of syntaxes. What's far more important
is that it does not advocate one belief or practice over another. If
you want, you are free to build your universe with multiple
inheritance. If you want you can shun it completely. Private
inheritance has a meaning and purpose that's understandably different
from public inheritance (see I read ec++), so it finds a place in the
language. I really must emphasize on the minimalist open-ended
philosophy of C++ as its winning point. It does not tie to a platform,
it does not provide fat libraries - you are free to add your own or
buy. But it transcends libraries, toolkits and utilities. It has the
capacity to integrate paradigms like none other. I guess in many ways
Java and C# are not programming languages in the same ways as C++ is. I
feel I will have a very biased outlook on C++ compared to other object
oriented languages. But I think there is so little redundant or
superfluous in C++, that this minimalism makes it a winning technology
years on end.


Cheers,
Andy

Martin Eisenberg

unread,
Apr 19, 2005, 6:30:29 PM4/19/05
to
From my first language, Turbo Pascal, I took the natural step to
Borland Delphi. I went on to learn C++ because of its reputation for
runtime efficiency and the availability of code and surrounding
material that comes with its wide use. I stay with it for these same
reasons, and also the geek factor of templates.

--
Quidquid latine dictum sit, altum viditur.

Timo Geusch

unread,
Apr 19, 2005, 6:24:19 PM4/19/05
to
Scott Meyers wrote:

> In my experience, C++ is alive and well -- thriving, even. This
> surprises many people. It is not uncommon for me to be asked,
> essentially, why somebody would choose to program in C++ instead of
> in a simpler language with more extensive "standard" library support,
> e.g., Java or C#. I can think of several reasons why one might
> choose C++, but I can also think of several reasons why one might
> choose a different language. Here, I'm not interested in why one
> MIGHT choose C++, I'm interested in why people DO choose C++. If
> you're reading this newsgroup, you presumably use C++, possibly in
> addition to other languages. I'd be very interested to know why you
> choose C++ over languages like Java and C#.

I'm actually programming in all three languages (not at the same time,
mind) but given a choice I'd write C++, unless it's a quick hack which
would most likely see me use C# or Java depending on the platform.

C++ wins for me because of it's expressiveness - it may be because I've
been around it for a long time but I still find that the way you can
adapt it has a certain kind of "natural language" way about it that
just suits my way of thinking.

That said, I wouldn't necessarily write throwaway tools in C++. A lot
of the work I've done over the last five-odd years was/is in the
financial sector and there, speed still rules. Discounting C and
Assembly language there isn't much left to squeeze maximum performance
out of any given piece of hardware.

Nevin ":-]" Liber

unread,
Apr 19, 2005, 6:28:44 PM4/19/05
to
In article <MPG.1cccf8dfd...@news.hevanet.com>,
Scott Meyers <Use...@aristeia.com> wrote:

> It's a truly neutral question: given that there are many
> languages to choose from, why do you choose to program in C++?

I enjoy it.

I can express the ideas I'm trying to get across in it better than I can
in any of the other languages I've dabbled with, and I believe that is a
property of the language itself (and not just my understanding of the
language vs. other languages).

The most important feature is support for "Resource Acquisition Is
Initialization". Nothing beats having destruction occur at well defined
times.

Next comes templates. This has lead to significant code reuse, which
was something that the supporters of objected oriented programming
promised but rarely delivered on (basically, inheritance forces a
coupling, and reusablility works better when things are decoupled).

Third is the STL. Thinking in terms of iterators and algorithms that
don't care about their underlying containers allows us to program in
higher, more abstract terms. While other languages could support this
as well (it is, after all, only a library), I haven't seen it done to
this extent and generality.

Also, in my experience, the C++ "competitors" concentrate on for the
weak areas of C++ at the expense of its strengths, and that isn't a
tradeoff I am willing to make.

Regards,
Nevin ":-)" Liber

Llewelly

unread,
Apr 19, 2005, 6:32:03 PM4/19/05
to
Scott Meyers <Use...@aristeia.com> writes:

> In my experience, C++ is alive and well -- thriving, even. This surprises
> many people. It is not uncommon for me to be asked, essentially, why
> somebody would choose to program in C++ instead of in a simpler language
> with more extensive "standard" library support, e.g., Java or C#. I can
> think of several reasons why one might choose C++, but I can also think of
> several reasons why one might choose a different language. Here, I'm not
> interested in why one MIGHT choose C++, I'm interested in why people DO
> choose C++.

[snip]

I know C++ better than any other language. IMO, most languages are
sufficiently flexible that what one can accomplish in a
particlular language depends more on how well one knows it than
the features, libraries, 'paradigms', or tools associated with a
particular language. Java and perl both have much better support
for generating web pages than C++ - yet I've seen, in several
instances, people who know C++ well write dynamic web applications
in C++ in less time than it would have taken them to *learn* to do
the same thing in Java or perl.

Furthermore, most of the alternatives are not as marketable as C++ . I
think Java and VB are the only languages as marketable as C++
. This is quite important; it means it is much easier to get paid
in part for maintaining a high level of skill in C++. If you can't
turn your use of a particular language into a profession, you will
likely have to do something else for forty to sixty hours a week,
and your efforts to maintain & improve your skill with that
language will be crammed into your copious free time. For a while
I worked with a man who preferred lisp to C++ for everything
except hard real time tasks. However, since he was employed using
C++, and not lisp, he was a much better with C++ than with lisp -
a factor which occasionly forced him to choose C++ over lisp even
for tasks unrelated to his employment.

As for the seemingly endless flaws of C++, when deadlines are tight,
and you *know* you'll be forced to use all the schedule padding
you dare to insert, the devil you know is better than the devil
you don't.

Phil Bass

unread,
Apr 19, 2005, 6:34:05 PM4/19/05
to
In message <MPG.1cccf8dfd...@news.hevanet.com>, Scott Meyers
<Use...@aristeia.com> writes

I use C++ mainly because I really like the language. Of all the
mainstream languages it's the only one I know with that "wow" factor.
I'm continually learning new, powerful and sometimes mind-blowing
techniques that, used properly, will help me to write better programs.
(And I've been writing C++ for more than 12 years.)

There are other reasons, too. I work on control systems software. Some
of it is close to the metal, some of it is time critical. It's not
embedded software, so it's not resource constrained. It has a GUI. And
the whole thing is built with essentially one language and a few
libraries. For that sort of application C++ is ideal.

I like, too, the philosophies C++ has inherited from C: you don't pay
for what you don't use, trust the programmer, etc.

I have just two complaints. First, for most people the language is too
big, too complex and too difficult to learn. Which means that I have
never learned all the fine details of every language feature and there
have been occasions in previous jobs when I've had to fight tooth and
nail for permission to use the right tool for the job in hand. ("You
can't use templates because novice programmers don't understand them.")

The second complaint is that we don't have a full toolkit of (standard)
libraries. Actually, it's worse than that. The C++ standard doesn't
mention threads or dynamic libraries and we need these things. We also
need networking libraries, GUI libraries, maths libraries, etc., etc.

Because C++ is such fun and so well suited to my field I can't imagine
switching to another language myself, but I've been predicting for some
time that C++ will be pushed aside by the likes of Java and C# for
precisely the reasons you mention. I stick by that prediction, but I
shall be sad to see it happen.
--
Phil Bass (ph...@stoneymanor.demon.co.uk)

Christof Stadler

unread,
Apr 19, 2005, 6:34:35 PM4/19/05
to
Scott Meyers <Use...@aristeia.com> wrote:

> I'd be very interested to know
> why you choose C++ over languages like Java and C#.

Because it was the only reasonable choice when I started to do OO
programming on Windows in 96.

Christof

Paavo Helde

unread,
Apr 19, 2005, 6:35:35 PM4/19/05
to

My current employer enforces C++ as the main development language, so that
should be the only reason I need. However, I would choose it currently for
any other serious project (except text processing which would go to Perl).
I believe the main point for C++ is the absolute power it gives you; not
the illusory power of assembler or hex editor, but the real 'divide-and-
conquer' power which enables me to build nice abstraction layers where
needed, and at the same time to go to the bare metal where needed.

I have previously programmed in Pascal, FoxPro and Java. I do not remember
having similar feelings about them. Mostly the issue was how to work around
the language shortcomings. Of course, that was fun, too :-)

Paavo

spip...@yahoo.com

unread,
Apr 19, 2005, 6:55:31 PM4/19/05
to
Scott,

I work in the games industry programming for consoles. I'll keep it
short!

In my case, C++ is an OO language with all the advantages of an OO
language (won't name them here per your request!), but that allows my
code to have deterministic behaviour. For example, in regards to
memory, I have exact control of memory layout. I can control memory
fragmentation by having custom tailored allocators for modules that
have very sporadic memory allocation behaviour. I know exactly when my
resources are being freed. While this is often not critical with
desktop applications where resources are abundant, it is critical for
games and any embedded type of software operating under scarce
resources (or trying to absolutely maximize them).

I perticularly like the fact that C++ comes to almost no performance
cost to those who do not abuse polymorphism/inheritance. There is also
added type-safety compared to C, and again at no performance cost (for
example the various type-strict cast operators).

But to sum it up, C++ is an OO language where the machine is not hidden
from you, at least not anymore than with C. And in my field this is
absolutely critical.

michael...@yahoo.com

unread,
Apr 19, 2005, 7:02:49 PM4/19/05
to
- I have a C background and it was easier for me to move to C++
- Familiar with the syntax. I also use VB, Java, perl, shell, but
prefer C++ language idioms or constructs (even though they are used in
some form in the above mentioned languages)
- Speed. Java, which came around the time I made the switch was not
mature enough. Even if it was, I still think that C++ is much faster
- Don't need PC devouring IDE to use it although they exist. All I need
is vi to build a large scale production system on Unix
- Can be used with a PC devouring IDE. I've also used these to build
GUI's. Since I prefer the C++ language itself, I find it more
satisfying than using say VB
- I find that it's good to know how internals work. Using much higher
level languages hides some of this. Don't get me wrong, I don't want to
go down to assembler or binary just yet...
- System architecture requirements

Regards,

Michael

Ralph Zhang

unread,
Apr 20, 2005, 1:54:01 AM4/20/05
to
Because c++ do solve problems that some other languages do not. And
sometimes c++ is quite a challenge to my mind, I enjoy that. But
whenever thing get done by Java or others more easily, I definitely
choose the latter.

Joshua Lehrer

unread,
Apr 20, 2005, 1:57:21 AM4/20/05
to
Thanks to people from work for helping me come up with this post. This is
mostly a repost of an internal newsgroup posting from a year ago.

We ended up using C++ for backwards compatability.

We were originally a system in Fortran running on a Gould mainframe. We
bought our own VAX computer from Digital and ported our Fortran code over to
it. That was around 1985.

Some new hires in 1988 convinced us that C, which they had been using in
college, was better than Fortran. They converted the existing employees.

C took root here because its VERY easy to call a C function from Fortran and
vice versa. The two languages look at the world in somewhat similar ways.
Yes there are differences, but there's a fundamental link compatability to
them.

Around 1991 and 1992, our new hires were learning C++ in college. While
they were working on convincing people to switch to C++, Digital released
their first C++ compiler in 1992. This was a real C++ compiler, not C with
classes. It wasn't so bad, even given that there was no standard yet.

As the standard library wasn't standardized, and the DEC compiler did a good
job at templates, we wrote our own standard library, including a vector
class, String class, maps, etc... These classes are still used, almost as
originally designed, today.

Of course, the best part about C++ is that it easily consumes things from
the C and Fortran world. And it can share back if the developer is good and
offers up some extern "C" functions.

This is both the beauty and the horror of C++. It easily fits into an
existing legacy system (eg. C, Fortran, and probably Cobol as well) because
it so willingly consumes from them. Of course, it doesn't
share back so well. In its defense, it can't. Sharing classes is hard.
Its part of the reason why you can't share object code across compiler
vendors.

C++ is friendly to the past, and it offered up new and useful features to
boot. So it took off here. And as a result its deeply rooted here.

Java hasn't taken hold. This is not because the compiler/runtime isn't
available on VMS, or isn't good- it may be. But integration between the
java runtime and our existing Fortran/C/C++ code base would very difficult.
The linkage is different, object layouts are not compatible, and the
overhead required to create and destroy objects for marshaling between the
two languages would be tremendous.

joshua lehrer
factset research systems
NYSE:FDS

hongseok.com

unread,
Apr 20, 2005, 2:07:06 AM4/20/05
to
Because you use it, either. :)

As you know, performance is one of the most important thing in game
programming. So I use C++.( at this point, my job is in public... )

There are some area only c++ can do, but I think...C++ can be minor
programming language like Assembly language since hardware speed grow
up so fastly.

Ahhh~~~ another important reason!
In my company, all of programmers are programming using c++ only. I
had no choice.

Eugene Gershnik

unread,
Apr 20, 2005, 2:06:00 AM4/20/05
to
Scott Meyers wrote:
> It's a truly neutral question: given that there are many
> languages to choose from, why do you choose to program in C++? I
> don't care if the reaons are technical, political, social, or what,
> I'm just honestly curious.

- Because I find it impossible to write robust code in most other languages.
- Because I want not to use proprietary languages to avoid what recently
happened to VB programmers (see http://classicvb.org/).
- Because C++ allows me to _freely_ move between very low-level code and
high-level abstractions.
- Because most often it is C++ that allows me to express my designs in a
most concise and elegant way. Other languages sometimes win on this but the
average balance is still in favor of C++
- Because C++ represents evolution and accumulation of knowledge rather than
revolution and endless reinvention of the wheel. The language that I'll
abandon C++ for will be the one that builds on its experience and improves
on it. It is not going to be something created out of ignorance.

All of these reasons make C++ my language of choice. Sometimes for a
specific domain or problem another language may be a better alternative.
Sometimes there are de-facto standards in particular areas. For example Java
and C# are quickly becoming the standard for Web applications. However, for
me they stay niche languages rather than general-purpose ones.

--
Eugene

Gorgen Givik

unread,
Apr 20, 2005, 2:08:49 AM4/20/05
to
It was simple, the company I started work for programmed in C++.
Being conservative but MS-centered, The decision taken by the management
(and the old wise programmers) is to switch to C# in the future.
//Gorgen

Vladimir Marko

unread,
Apr 20, 2005, 2:14:59 AM4/20/05
to
Scott Meyers wrote:
[snip]

> Here, I'm not
> interested in why one MIGHT choose C++, I'm interested in why people
DO
> choose C++. If you're reading this newsgroup, you presumably use
C++,
> possibly in addition to other languages. I'd be very interested to
know

> why you choose C++ over languages like Java and C#. My goal here is
not to
> start a C++ love-fest, nor is my goal to get people to dump on other
> languages. It's a truly neutral question: given that there are many

> languages to choose from, why do you choose to program in C++?
[snip]

Your question is actualy two questions:

1. Why people DO choose to _learn_ C++?
2. Why people who already know C++ and Java/C#/??? reasonably
well DO choose to use C++ over the other languages.

My personal answers are:

1. When I switched from Pascal to C++ (in 1995 or 1996) it was
just the OO language at hand. And that's it. If I had to choose
the language today I guess I wouldn't have the deep knowledge
of C++ to assist my decision, would I? So it seems to me that
the choice is allways based on what you hear/read about the
languages and which sources you trust more.

2. Aside from the portability issues and old C code reuse this
question is really _asking_ for a "C++ love-fest". I'll try to
keep it short.
Since I started to work on commercial projects over two years
ago my perception of C++ completely changed. One [key]word to
say it all (almost): template. I like the level of abstraction
templates provide (abstract algorithms) and the compile-time
"magic" (metaprogramming and the use of the compile-time
informations for correctness checking and optimization).
One other thing... I like when I can control what the program
does. And garbage collection just feels wrong even though it
may sometimes be appropriate.

Regards,
Vladimir Marko

Gerhard Menzl

unread,
Apr 20, 2005, 5:12:31 AM4/20/05
to
Scott Meyers wrote:

> given that there are many languages to choose from, why do you choose
> to program in C++?

- freedom of design choice, no paradigmatic straitjacket
- support for programming at a wide range of abstraction
levels, from close to the metal to very high level
- emphasis on compile-time error detection
- support for generic programming
- C++ Standard Library
- deterministic and automatic resource cleanup

--
Gerhard Menzl

#dogma int main ()

Humans may reply by replacing the thermal post part of my e-mail address
with "kapsch" and the top level domain part with "net".

David Turner

unread,
Apr 20, 2005, 5:10:03 AM4/20/05
to
Because I find it's easier to write provably correct programs in C++
than in most other languages. It's far easier to separate concerns in
C++ than in any other popular language (with the possible exception of
Python), and this leads to vastly increased robustness.

When I'm looking for a solid framework with a carefully designed
structure, the natural choice is C++. When I want a UI or some other
relatively throwaway component, I'll generally go with Python or
sometimes C#. IMHO, Java is a bit of a nowhere language. I seem to
recall Alexander Stepanov saying once that it was the only language
that had taught him nothing. I agree.

As an aside, I think Java (and therefore C#) represents the logical
conclusion of my first six months' woeful misapprehension of what C++
was about... back when object orientation seemed like an important
concept in the language. Java is the language I would have begged for
when I was learning C++ and sticking everything in an object and every
object on the heap. Does anybody else feel the same way?

Regards
David Turner

Basil

unread,
Apr 20, 2005, 5:16:19 AM4/20/05
to
> In my experience, C++ is alive and well -- thriving, even. This surprises
> many people. It is not uncommon for me to be asked, essentially, why
> somebody would choose to program in C++ instead of in a simpler language
> with more extensive "standard" library support, e.g., Java or C#. I can
> think of several reasons why one might choose C++, but I can also think of
> several reasons why one might choose a different language. Here, I'm not

> interested in why one MIGHT choose C++, I'm interested in why people DO
> choose C++. If you're reading this newsgroup, you presumably use C++,
> possibly in addition to other languages. I'd be very interested to know
> why you choose C++ over languages like Java and C#. My goal here is not to
> start a C++ love-fest, nor is my goal to get people to dump on other
> languages. It's a truly neutral question: given that there are many

> languages to choose from, why do you choose to program in C++? I don't
> care if the reaons are technical, political, social, or what, I'm just
> honestly curious.
>

Hello.

I use C++ because:

1. Compatibility with C.
2. Templates (this is very power concept)
3. I often work for embedded system. For this system we not have Java
and C# compilers. And Java and C# is not support real time.
4. C++ have full control of overhead.
5. Class inheritance support.
6. Portability.


Sincerely yours
Basil

Robert Kindred

unread,
Apr 20, 2005, 5:18:01 AM4/20/05
to

"Scott Meyers" <Use...@aristeia.com> wrote in message
news:MPG.1cccf8dfd...@news.hevanet.com...
> In my experience, C++ is alive and well -- thriving, even. This surprises
> many people. It is not uncommon for me to be asked, essentially, why
> somebody would choose to program in C++ instead of in a simpler language
> with more extensive "standard" library support, e.g., Java or C#. I can
> think of several reasons why one might choose C++, but I can also think of
> several reasons why one might choose a different language. Here, I'm not
> interested in why one MIGHT choose C++, I'm interested in why people DO
> choose C++. If you're reading this newsgroup, you presumably use C++,
> possibly in addition to other languages. I'd be very interested to know
> why you choose C++ over languages like Java and C#. My goal here is not
> to
> start a C++ love-fest, nor is my goal to get people to dump on other
> languages. It's a truly neutral question: given that there are many
> languages to choose from, why do you choose to program in C++? I don't
> care if the reaons are technical, political, social, or what, I'm just
> honestly curious.
>
> Thanks very much to everyone -- and I hope there will be many -- who
> participates in this thread.
>
> Scott
>

We do most of our programming here in C++, but we have a neighbor group that
does their work in Visual Basic. We are close enough to them that we can
see how they are doing. I will never forget when we switched from Office 95
to Office 97. I don't know any details, but Microsoft changed the language
on them, and many programs broke. They had purchased some third-party
visual components, which also broke. They had no source to the components,
and so could not recompile. This was a big blow, having programs which
worked to not work anymore and having no budget for extra development. This
is why I do not trust any single company to own my language.

Because Java did not make it into the ISO standard, I tend to shy away from
it, though I have not heard of anything bad about changes. To be perfectly
honest, I am not so pure of heart myself, being a Borland C++ Builder
programmer. Borland has extensions, such as __published, __closure, and
__property. Their AnsiString also has nothing to do with ANSI (it is their
Object Pascal string). This said, Builder has been pretty stable for me.
The sad thing is that due to lack of support and C++ compatibility, we are
now forced to leave it for Visual Studio. I have received the CD's for
Oracle 9i, and there is no OCI support for Builder as there was in Oracle
8i. I have not started on the conversion yet, but I do have some books on
order. From what I have seen, C++.NET does not look like C++ to me, and
gives me the creeps.

Finally, there is the macho side of things. There is probably no practical
reason to own a Chrysler Thomahawk motorcycle, but I am sure people are
buying those things. With few other languages can you write the operating
system, utilites, the compiler itself, and its own debugger. I have used a
16-bit debugger to debug an 8-bit debugger debugging an 8-bit program. I
have also used a debugger to debug a compiler compiling its own source. I
know most people do not do this kind of programming, but like I said, it is
a macho thing. I know of no other language capable of the Curiously
Recurring Template Pattern (Leda does not count). Assembly can do all of
these things, but is not portable, and very wordy. Now that I am accustomed
to C++, C also seems wordy to me. I can write things much more concisely
now. I love the way C++ can make wrappers for ugly code.

When C++ begins to seem like overkill, I would tend to use visual
programming (dropping components from a palette), or a nice portable
scripting language like Ruby. Ruby can instantiate C++ objects, and of
course the visual components would be written in C++.

Finally Dmitry's comment above is a good one. A new language cannot just be
better, it must be much better to justify crossing over the energy barrier
to a new language.

hth, Robert Kindred

Jeremy J

unread,
Apr 20, 2005, 5:27:55 AM4/20/05
to
Hey,
I use C++ because it has the great industry support for RealTime app
development. This is also why I do not use simpler GC languages.
Besides, I like that C++ allows you to be way more clever than you
should be, it seems a bit more creative than say, Java, because there
are pretty much no enforced design rules. I think it unlikely that any
major programming paradigm shifts will occur in languages that
dogmatically enforce their preferred paradigm. I guess you can say C++
is pretty 'artsy'.

Happy Programming,
Jeremy Jurksztowicz

Alex Blekhman

unread,
Apr 20, 2005, 5:39:22 AM4/20/05
to
Scott Meyers wrote:
> [...] I'd be very interested to know why

> you choose C++ over languages like Java and C#.

Because C++ is a libertarian language.

I don't know actual views of Bjarne Stroustrup or Stanley
Lippman or other key engineers that shaped C++ as
programming language. However, the spirit of C++ is clearly
libertarian. As Herbert Schildt noticed in his "The Art of
C++" there are two competing philosophies in programming
languages. One teaches that language should guard programmer
from "perils": carnivorous wild pointers, quicksands of
memory allocations, blasphemy in machine language, etc..

The other philosophy, that of C++, provides programmer with
least possible outset of keywords and built-in facilities.
Then it declares programmer as supreme ruler. If you're
mighty, your knowledge is sharp and solid, then you'll be
the king and only sky is the limit. However, if you don't
know how to hold a gun, then you'll shoot yourself in the
foot. In any way, you'll have most precious thing in this
world: freedom to choose.

As always, freedom imposes some paradoxes on us. Being
freemason of debuggers and core dumps I appreciate the
option to apply my skills the most. Thus, C++ is my choice.
But once I become employer, at that very moment I'd want to
hire herd of predictable, replaceable as much as possible,
developers in "caring" languages.

--
Alex
tkfx [at] yahoo dot com

Phil Armitage

unread,
Apr 20, 2005, 5:38:39 AM4/20/05
to
> possibly in addition to other languages. I'd be very interested to know
> why you choose C++ over languages like Java and C#. My goal here is not to

I program in C++ because:

- It's powerful
- It's a non-proprietary standard
- Free tools exist (compilers, libraries, related software)
- It's portable (within reason)
- It's fun to work with (with a friendly, active community!)

No other language provides such a good mix IMHO.

Phil

ulrich

unread,
Apr 20, 2005, 8:12:05 AM4/20/05
to
On 18 Apr 2005 05:08:51 -0400, Scott Meyers <Use...@aristeia.com> wrote:

[...]


> languages. It's a truly neutral question: given that there are many
> languages to choose from, why do you choose to program in C++? I don't
> care if the reaons are technical, political, social, or what, I'm just
> honestly curious.

i started programming in c++ with borland's turbo c++ 1.0, so it's quite
some time.

meanwhile, i also used java a bit, even gave lectures of it, got to know
perl, which i would choose for text processing tasks any time, and wrote
MatLab programs for three years. for four years now i am working as
c++ developer.

all in all, i like and prefer c++ because of it's ability of expression,
but still not forcing one to do anything more complex than necessary.
imho, the more expressive a programming language, the easier it is to
write clear programs (closer to the natural ways of thought). although
the
expressiveness comes at a price (longer learning time), the advantage of
c++ is that you do not need to learn everything at once (a quite little
part suffices) to start programming...

i am most fascinated by the upcoming techniques of template (meta)
programming, and all this stuff that alexandrescu and others do. it
almost
seems that the language carries possibilities which even the creators
did
not think of... :)

ulrich

Andreas Scherer

unread,
Apr 20, 2005, 8:21:36 AM4/20/05
to
I started with native C on the Amiga, porting various GNU software and
TeX (Web2C, not Pascal). Later, Lattice/SAS added "some" C++ features
to the compiler and I was impressed by the improved type system of
C++. For quite some time I used C++ as "a better C"; no need for
classes or OO. (And the compiler didn't support templates or
exceptions anyway.)

A major step forward was the advent of "the STL". I learned about it
in an "advanced" computing course, at the precise moment when g++ was
/not quite/ capable of dealing with it. It was fun to do homework
assignments using STL-features (plus "string") without the help of the
compiler (really!). Soon after, g++ supported "the STL" and the world
no longer was the same.

At about the same time I somehow "got the catch" of object
orientation, but I can not remember the cause or trigger. Maybe it was
the code base of my employer (some nice class hierarchies with
polymorphism, but no templates nor exceptions; we used VS 4.1
_without_ the STL, and for some time I fought hard for the update
[long since obsolete]) or one of the numerous C++ books I read at the
time (probably Lakos or "the bible"). (I also read Ousterhout and
Wall, but didn't get the hang of Tcl/Tk and I was comfortable with AWK
and SED.)

Next came boost::shared_ptr, shortly followed by BGL (bringing me
right back to the top of this message, when I helped improve the
BGL-SGB interface) and other parts of the Boost C++ Libraries. I admit
to only scratch at the surface of many of the techniques presented in
this collection. (Alexandrescu was a tough read and the Boost group
hasn't cared to stop going ever further.)

In the past years I seem to have settled with C++ as "just a tool". I
use it in conjunction with various other programming languages (Perl,
Doxygen, GraphViz, LilyPond), mostly because of its standard library
or boost or some external library (e.g., Xerces). Many of the tools
and libraries are written in C++, but that's nicely hidden by
"configure/make" or even RPM. Normally, I use a very small subset of
C++, mostly related to GoF patterns. I like its expressiveness
(templates, operator overloading, OO), its standard library
(algorithms, containers), and the widespread support through external
tools and libraries.

Cheers,
Andreas

omer.s...@gmail.com

unread,
Apr 20, 2005, 11:49:10 AM4/20/05
to
I choose to program in C++ because it is a multi-paradygm language - it
allows me to decide what abstraction level to use.

My primary field of interest is "network programming". Within this
field, many low level activities (bit-twiddling, efficient allocation,
interacting with hardware) coexist with many high-level activities
(protocol stacks, graph algorithms, logical/physical maps etc.) By
using a tool that allows me to choose the highest possible abstraction
level, I can achieve the best result in shortest time.

Ivan Vecerina

unread,
Apr 20, 2005, 11:48:45 AM4/20/05
to
"Scott Meyers" <Use...@aristeia.com> wrote in message
news:MPG.1cccf8dfd...@news.hevanet.com...
> In my experience, C++ is alive and well -- thriving, even. This surprises
> many people. It is not uncommon for me to be asked, essentially, why
> somebody would choose to program in C++ instead of in a simpler language
> with more extensive "standard" library support, e.g., Java or C#. I can
> think of several reasons why one might choose C++, but I can also think of
> several reasons why one might choose a different language. Here, I'm not
> interested in why one MIGHT choose C++, I'm interested in why people DO
> choose C++.

I'd try to summarize it in 3 points:
(1) Static typing and compile-time checks
(2) Multi-paradigm programming, expressiveness
(3) Control and efficiency
(4) Portability and popularity

I have professionally had to use a number of other languages (C, assembler,
Delphi, OO Pascal(Mac), Perl, PHP, and some Objective-C, C# and Java).
I always ended up wanting to go back to C++ for one or more of the above
reasons.

(1) Static typing and compile-time checks
Once code I've written compiles, it usually also works. When using
the right programming style, many bugs (not just typos) get caught
at compile time. Sure, C++ may still have a way to go, and you have
to be aware of UB cases, but don't ask me to use a language that
does not support 'const', or has weaker type checks at compile-time.

(2) Multi-paradigm programming, expressiveness
I grew up with OOP, but after discovering the expressiveness
offered by mixing-in other techniques (generic, procedural, etc),
I would never want to go back to a pure object-oriented language.
Hopefully C++0x will do even better (e.g. by making lambdas easier
to use, and providing some support for introspection).
In terms of OOP support in C++, I would also love to have dynamic
dispatching à la SmallTalk or Objective-C built into the language
( Objective-C++ anyone? ). For GUI programming in particular,
this would be handy, and there are too many C++ frameworks that
invented their own contorted dynamic dispatching of messages
(such as Qt's MOC, or event MSWindows-like message codes and tables).

(3) Control and efficiency
Working at high levels of abstraction with a good level of efficiency,
and being able to optimize using lower-level code whenever needed.
A special mention for RAII and deterministic destruction:
Using RAII, containers, and smart pointers a lot, and reference
counting in the few cases where it was needed, I have never missed
not having garbage collection in C++: running leak detection tools
by curiosity once in a while, I have had only one memory leak
reported 5+ years ago... I think a good Java or C# developer
is leaking non-memory resources much more often than that.
And of couse, having exceptions for error handling is a must.

(4) Portability and popularity
Eiffel, Dylan, ... are nice, but hardly an option on the marketplace.
The availability of compatible, standards-compliant C++ implementations
on most platforms is a great asset of C++. I don't like being locked
in to a proprietary solution.


Kind regards,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form

M Jared Finder

unread,
Apr 20, 2005, 11:59:20 AM4/20/05
to
Scott Meyers wrote:
> In my experience, C++ is alive and well -- thriving, even. This surprises
> many people. It is not uncommon for me to be asked, essentially, why
> somebody would choose to program in C++ instead of in a simpler language
> with more extensive "standard" library support, e.g., Java or C#. I can
> think of several reasons why one might choose C++, but I can also think of
> several reasons why one might choose a different language. Here, I'm not
> interested in why one MIGHT choose C++, I'm interested in why people DO
> choose C++. If you're reading this newsgroup, you presumably use C++,
> possibly in addition to other languages. I'd be very interested to know
> why you choose C++ over languages like Java and C#. My goal here is not to
> start a C++ love-fest, nor is my goal to get people to dump on other
> languages. It's a truly neutral question: given that there are many
> languages to choose from, why do you choose to program in C++? I don't
> care if the reaons are technical, political, social, or what, I'm just
> honestly curious.

The short answer is because I can't find a programming job using Common
Lisp (or any language with good macros). ;)

But you are probably more interested in the long answer.

Between C++, Java, and C#, it's no content -- C++ provides the most
powerful and expressive abstraction capabilities. Java and C# were both
designed to prevent bad code from being written (ha!), and do this by
severely limiting the language's power. Every time I have to write
MyClass.staticMethod( args ) I question why they decided to make free
methods illegal. Also, I find that my Java and C# code tends to be a
lot more verbose than my C++ code, though I feel that generics will fix
a significant amount of this.

Java and C# do provide some nice features that I miss in C++. Garbage
collection in particular is great for when memory is not an issue at
all; I can finally write functions that return what they are supposed to
return instead of using "out" parameters. It's too bad neither language
provides a way to hint to the compiler that this object could be stack
allocated (C#'s using does not guarantee the right things, and value
types make the choice at the wrong spot). If garbage collection was
sold as facilitating abstraction, and not as preventing memory leaks
(HA!), then I'd have seen the light a whole lot sooner.

-- MJF

Oliver Kreylos

unread,
Apr 20, 2005, 11:58:22 AM4/20/05
to
Scott Meyers wrote:
[snip]

Why I use C++...

The main reason is that C++ is a very natural way for me to come up with
designs for programs to do a certain job. This might not be a strength
of the language but just the way I think and the fact that I use it a
lot, but other languages I've tried and used (from assembler to C, lisp
to scheme to Haskell to Logo, Eiffel to Simula, Prolog, Java) always
seemed to be awkward to "think in." C++ just fits, with all its
sometimes annoying peculiarities.

Another reason is that I'm working in computer graphics, visualization
and virtual reality, and getting those 120 frames per second is of the
essence. This requires things like finely controlling construction,
destruction and memory allocation, and being able to program in a
cache-aware fashion.

The last (but not least) reason is that I found out - quite by accident
- that code reuse really works with C++. It turns out that for almost
any problem somebody throws at me there is some piece of code I wrote
earlier (sometimes a few years back) that will do the job - often
without having to change it at all. I believe this reusability comes
from the decoupling offered by templates. For me, templates are *the*
killer feature of C++. Type-safe, efficient, and generic at the same
time. I just finished implementing the second version of a visualization
system for a wide variety gridded data representations (think "STL for
scientific data"), and templates allowed me to mix and match components
almost arbitrarily. Want to do isosurfaces on tetrahedral grids? Sure,
it's exactly the same code as isosurfaces on regular grids, but runs on
a completely different data structure that has completely different
internal algorithms. Want to speed up rendering using vertex buffer
objects? Sure, change one class in one place, and all rendering is
faster. You don't get this kind of versatility from run-time
polymorphism only, and surely not at that speed. The fact that C++
offers both - run-time polymorphism by different (virtual)
implementations of the same interface, and compile-time polymorphism by
generic (template) access to completely different interfaces - allows
for very powerful and expressive hybrid designs.

I better stop before I start foaming at the mouth.

Cheers,

Oliver

--
Email: kre...@cs.ucdavis.edu
WWW: http://graphics.cs.ucdavis.edu/~okreylos/ResDev

mzdude

unread,
Apr 20, 2005, 12:53:54 PM4/20/05
to

Scott Meyers wrote:
> I'd be very interested to know
> why you choose C++ over languages like Java and C#. >
> Scott
>
>

It's short and easy to spell
There is no proprietary smell.
It's quick, fast and lean
Not tied to a specific machine.
It does what I need,
It does it with speed.
Thousands of $ have been spent
To training seminars I went.
Templates, new exciting and abstract
Have improved the language. That's a fact.
My brain over the years has been taught
Of the language idiosyncrasies fraught.
While, with other languages I dabble
I must stop this random babble.
Mostly I use C++ by and large
Because like Al Haig, I'm IN CHARGE.

cpi...@gmail.com

unread,
Apr 20, 2005, 4:50:44 PM4/20/05
to
I'd like to use C++ because:
- It allows a lot of freedom
- It allows to develop a domain language
- I can use it to create highly efficient code
- I know it pretty good

Unfortunately, I subscribe to other's oppinion:
- It is hard to learn.
- C++ development is not so productive, comparing with other languages
(C# or Java).

Kybos

unread,
Apr 20, 2005, 9:56:11 PM4/20/05
to
I chose C++ because I want to go as low as I can with the level of my
programming language without becoming innefficient (ie. coding big
projects in assembler makes development slow down excessively). The
advantages of the low-level approach are several... better performance,
more control over your code, a wider range of possible approaches, etc.

I personally consider C to be "The Standard" in programming, so
basically C++ is not a bad choice from this perspective.

Chris Croughton

unread,
Apr 20, 2005, 9:57:13 PM4/20/05
to
On 18 Apr 2005 05:08:51 -0400, Scott Meyers
<Use...@aristeia.com> wrote:

> In my experience, C++ is alive and well -- thriving, even. This surprises
> many people. It is not uncommon for me to be asked, essentially, why
> somebody would choose to program in C++ instead of in a simpler language
> with more extensive "standard" library support, e.g., Java or C#. I can
> think of several reasons why one might choose C++, but I can also think of
> several reasons why one might choose a different language. Here, I'm not
> interested in why one MIGHT choose C++, I'm interested in why people DO
> choose C++. If you're reading this newsgroup, you presumably use C++,
> possibly in addition to other languages. I'd be very interested to know
> why you choose C++ over languages like Java and C#. My goal here is not to
> start a C++ love-fest, nor is my goal to get people to dump on other
> languages. It's a truly neutral question: given that there are many
> languages to choose from, why do you choose to program in C++? I don't
> care if the reaons are technical, political, social, or what, I'm just
> honestly curious.

C++ is portable, none of the other languages with comparable power are
portable (C# is MS only, Delphi is Borland, Java is Sun licenced and
portable only as long as you stick to the basics).

C++ allows me to do the things I want without being contrained to
everything being a class and massive names for no real gain (as in
Java).

C++ allows me to link with code written in other languages easily, and
to have the full power of C in addition to OO features.

I program in C and C++, most things for myself or utilities for work I
do in C++ because it's a lot shorter and clearer code (strings, vectors,
lists and maps, for instance) with better re-use through templates.

For short scripts I use Awk, C++, the bash shell (with sed, grep etc.)
or, if I really have to, Perl.

> Thanks very much to everyone -- and I hope there will be many -- who
> participates in this thread.

Any particular reason, or just personal curiosity?

Chris C

Laurens

unread,
Apr 20, 2005, 9:55:51 PM4/20/05
to
I'm making the transition from Java to C++ because I'm writing
commercial software for PalmOS and WinCE handheld devices, for which
C/C++ is the only reasonable choice. Java is just not viable for those
environments.

I'm still writing my desktop applications in Java, but, in time, I might
switch over to C++ there as well.


Regards
-Laurens

Branimir Maksimovic

unread,
Apr 20, 2005, 10:31:45 PM4/20/05
to
Scott Meyers wrote:
> In my experience, C++ is alive and well -- thriving, even. This
surprises
> many people. It is not uncommon for me to be asked, essentially, why
> somebody would choose to program in C++ instead of in a simpler
language
> with more extensive "standard" library support, e.g., Java or C#.

Primary reason is level of control. C is pretty good at that but needs
features that C++ provides. java and C# are not good when speed (read
level
of control) is main requirement.
I guess for same reason Sun's hotspot java vm is implemented
in c++, rather then java :)
Main power of c++ is not portability, rather one can do
system specific things *and* abstract that easilly.
Problem with java and (just guessing c#) is that one can't
do non portable things with them.
For example java programmers didn't have support for mmaping,
multiplexed and nonblocking io before nio package (came with 1.4),
while
c++ programers didn't have to wait for that, and with java one is
stucked
with nio interface,it's cappabilities and semantics.
Finally, nio package have abstract Buffer class :) with concrete
mmapped byte, byte, char, long, double, float,int and short buffers
and this is funny when in c++ buffer is simply: type buf[...];
or if memory mngment is needed vector <type> buf;
because c++ arrays are actually raw memory buffers :)
So for simple things such as reading data into buffer java needs
complex
package of classes which are probably written in other
language(guess c or c++:).
As a conclusion, some things done with java and c# are step forward
while other
are step back, because real question is *why* java needs buffer
classes? :)

Greetings, Bane.

CrayzeeWulf

unread,
Apr 20, 2005, 10:29:52 PM4/20/05
to
Because of the following primary reasons:

1. It has a standard (that is not controlled by a single corporation).
2. It allows object-oriented design.
3. It is available on multiple platforms.
4. Availability of excellent GNU/Open Source development tools.
5. Ability to write everything from an embedded kernel to a GUI.

Thanks,
--
CrayzeeWulf

enrique

unread,
Apr 20, 2005, 10:31:24 PM4/20/05
to
I code in C++ b/c my job requires it, and I happen to be pretty good at
it.

I code in Java, too, as well as a number of other languages. I use
what the job requires. Simple as that.

Lars Duening

unread,
Apr 21, 2005, 4:41:52 AM4/21/05
to
Scott Meyers <Use...@aristeia.com> wrote:

> It's a truly neutral question: given that there are many
> languages to choose from, why do you choose to program in C++?

Writing as somebody who originally came from the Modula/Oberon universe,
still has a soft spot in his heart for those languages, and for quite
some time considered C++ a step backward:

C++ is my primary language because of its expressive power - the ability
to define in detail how a new datatype works basically is allowing me to
extend the language to best fit the problem solution, whereas other
languages remain static and allow you just to write programs in that
language.

Together with other language features - templates, STL, idioms like
RAII, support for multiple paradigms, even the preprocessor -
programming in C++ feels natural, and as a programmer you can reap great
rewards for even modest learning efforts.

The low reliance of C++ on external tools is a welcome bonus :-)
--
Lars Duening; lars at bearnip dot com

Scott Meyers

unread,
Apr 21, 2005, 4:44:47 AM4/21/05
to
On 19 Apr 2005 17:54:28 -0400, Nicola Musatti wrote:
> P.S. Now, if I only started writing *about* C++, instead of *in* C++, I
> might stand a better chance of becoming the next Scott Meyers :-)

Do we really need another one of those?

:-)

Scott

Scott Meyers

unread,
Apr 21, 2005, 4:55:57 AM4/21/05
to
On 20 Apr 2005 21:57:13 -0400, Chris Croughton wrote:
> Any particular reason, or just personal curiosity?

Mostly curiosity, although, in theory, I'm supposed to know everything
about everything about C++, so learning this kind of thing is sort of my
job :-)

It's interesting to see the things that people consider important. Many of
the things that people have cited as reasons for using C++ don't surprise
me, but I was mildly surprised to see that several people view MS's control
of .NET and Sun's control of Java as a minus for those platforms. It's a
perfectly reasonable concern, but I didn't expect it to come up as often as
it has. I suspect that for most of the people who have asked me why so
many people continue to program in C++, this is not something they take
into consideration.

I hope that more people will post their reasons for using C++.

Scott

ka...@gabi-soft.fr

unread,
Apr 21, 2005, 5:05:45 AM4/21/05
to
Ivan Vecerina wrote:
> "Scott Meyers" <Use...@aristeia.com> wrote in message
> news:MPG.1cccf8dfd...@news.hevanet.com...

> (1) Static typing and compile-time checks


> Once code I've written compiles, it usually also works. When
> using the right programming style, many bugs (not just typos)
> get caught at compile time. Sure, C++ may still have a way to
> go, and you have to be aware of UB cases, but don't ask me to
> use a language that does not support 'const', or has weaker
> type checks at compile-time.

I totally agree here. But it's worth pointing out that the key
is not just static typing, but actually using the static typing
in idiomatic constructio