Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why do you program in C++?

177 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 constructions. Java has pretty much the same rules
as C++ here -- they're actually a tad better, since you cannot
convert a double to a char without an explicit cast. But the
absence of templates (or at least a preprocessor and
<generic.h>) in the Java I knew meant that while you had to be
explicit to use dynamic typing (as in C++), you actually used it
in a lot of cases where the design didn't call for it.

> (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).

Perhaps most important, I can do things the language designer
didn't take into account. Including accessing low level system
facilities. When all is said and done, `` extern "C" '' is a
lot easier to use than JNI, and although Java offers a lot more
built-in, no language manages to offer everything you need.

> (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.

A good developer doesn't leak resources, regardless of the
language:-). I can only remember one memory leak in my 10 or
more years of C. It isn't a question as to whether it can be
done, it's a question of how much work it takes to do it. I
agree that if you have a good design, most of the time, it is
obvious who owns what, and who should delete. I'm certainly
able to write correct C++ without garbage collection, but it
would require less work if we had garbage collection. Just as I
am able to maintain transactional consistency in Java, but it
would be easier if Java had deterministic destructors. (If I
had to choose one, I'd go with the destructors. But why
shouldn't I have both?)

> 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.

I think that's actually the key. When I first read Scott's
question: why do you program in C++, the immediate answer in my
mind was: because its there:-). I am, in fact, curious as to
what Scott thinks of all the answers. His question wasn't why
you liked C++, or why you thought it a better language than Java
or C#. It was why you actually used the language. I've
expressed my opinions concerning the relative advantages of C++
over Java before, but... the real reason I use C++ in my work is
because my boss tells me to. If he said use Java, I'd use
Java. For that matter, if he said use Cobol, I'd learn Cobol,
and use it:-).

Which of course just shifts the blame, and I'm sure that Scott
would then ask, why does my boss choose C++. Except that then,
none of the technical reasons we've been mentionning really
hold, because the people making the decision to use C++
typically don't know it in that level of detail. Where I am
currently, for example, the motivation is obvious: the code goes
back over ten years, to a time when C++ was pretty much the only
game in town, at least if you wanted OO. (They're actively
experimenting with C# in some newer projects. But PC's still
don't have the IO bandwidth for the server side, so that part
will stay in C++.) At my previous employeurs, there was a need
to access low level features of the OS without the overhead of
JNI. (There, they used Java for the web based human
interface -- regardless of the relative merits of the languages,
it's hard to beat the existing infrastructure.)

In the end, the people who choose a language for a projet
generally will make the decision more on "political" grounds
(with no negative implecations meant) than on technical
grounds. And the first and foremost reason is "because it's
there"; as you said, they don't chose Dylan, Eiffel or even Ada,
because those languages simply aren't successfully marketed on
the targetted platforms. (Successfully is a key word here. We
use both Sun CC and g++, and both Sun and gcc also supply Ada
compilers. But nobody uses them, or at least, a lot less people
than those who use C++.) In the end, the choice is pretty much
limited to C, C++ or Java -- C is perceived as out of date and
old fashionned, and Java either as being too slow (somewhat true
on a Sparc, where it isn't supported as well as under Windows),
or as being a niche language, fine for Web applications, but not
applicable for "real programs" (whatever those are). And of
course, if you're targetting a Unix base, C# isn't (yet?) an
alternative.

So while I generally think that the choice was correct, it's
rare that I think it was for the right reasons.

--
James Kanze GABI Software
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jonas Norberg

unread,
Apr 21, 2005, 5:08:28 AM4/21/05
to
I'm in the games industry, and C++ is natural choice.
* Great Performance
* Good compilers on all platforms (Win, Xbox, PS2, ...)
* Middleware and 3rd-party libs are either C or C++
* C++ supports all coding-styles I need, from OO and templates, to
platform specific optimizations.

__
Jonas Norberg

ka...@gabi-soft.fr

unread,
Apr 21, 2005, 6:31:43 AM4/21/05
to
CrayzeeWulf wrote:
> Because of the following primary reasons:

> 1. It has a standard (that is not controlled by a single
corporation).

So do Pascal and Basic.

Regretfully, the C++ standard is about as relevant if you are
programming in C++ as the Pascal standard is for Pascal, or the
Basic standard for Basic. To date, only one vendor (EDG) has
bothered to implement it; apparently, the others just don't
care.

--
James Kanze GABI Software
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

"Daniel Krügler (ne Spangenberg)"

unread,
Apr 21, 2005, 9:42:08 AM4/21/05
to
Hello James Kanze and Scott Meyers,

ka...@gabi-soft.fr schrieb:

>CrayzeeWulf wrote:
>
>
>>Because of the following primary reasons:
>>
>>
>
>
>
>>1. It has a standard (that is not controlled by a single
>>
>>
>corporation).
>
>So do Pascal and Basic.
>
>Regretfully, the C++ standard is about as relevant if you are
>programming in C++ as the Pascal standard is for Pascal, or the
>Basic standard for Basic. To date, only one vendor (EDG) has
>bothered to implement it; apparently, the others just don't
>care.
>

Strictly said that is true, but we have to see two sides of the coin:

1) While 100% standard conformance of C++ is rarely found, most current
compilers support
at least 90% of it. So the C++ standard is in many points heading
the implementations. Please
don't misunderstand that statement: I don't think that the standard
development is **too** quick
for implementors.
Of course there exist also language extensions, but I rarely need
them (If I use them, than just
because our programming guide demands it). Some of them are needed
in low level parts (e.g.
alignment issues), but many (most?) programs don't need them.

2) Viewing at Pascal (I cannot say much concerning the Basic standard,
although I wrote my first
computer program in Basic), its standard is totaly behind reality,
to my opinion. AFAIK
Object Pascal has no ISO standard (I would like to hear news
concerning that point), and one of
the most popular implementations, Delphi, are quite good to use, but
the lack of portability is not so
nice.

When I started programming with C++ I started to program in a portable
way and tried careful to
be as compliant as possible. Interestingly the C++ standard is very
importand for my daily programming,
while a similar need/wish of compliance to a standard of other languages
cannot be found (at least not in my
direct environment). I assume the reason is, that most programmers of
very "lightweighted" languages
(w/o, templates, w/o multiple inheritance,...) are not interested in
comformance and do program
using a very specific vendor, for a very specific OS, etc.

Especially in the beginning I was amazed that it is possible to develop
a program under a given OS, compiler,
library and so on, than providing this program to another guy at a
totally other OS, compiler, etc and it
worked! This is surely true for C, too, but the expressiveness and
especially the strongly mathematically
influenced parts of the C++ language (templates) and standard library
(concepts) are extremly appealing to
me (given my background as physical chemist) and I have not seen a
comparable language so far (I have
done assembler, Basic, Pascal, C, Delphi, a little bit Fortran 77/2000,
Java and even some steps with the pure
graphically oriented language of LabView otherwise).
The power of compile-time checks in C++ are tremendously useful and
brings the C++ near to an algebraic
language with high deductive capabilities. I can only say that I'm
thrilled for its further evolution (e.g. direct
language support for concepts).

Furtheron are the rules of object construction and destruction simply
amazing and allow very important idioms
as RAII, which provide an excellent way of flow control.

Up to now I didn't mention the fact, that C++ also allows highly
performant programs. This is also a very
important reason for me to use this language. I still do hourly long
calculations of molecular spectra but these
hours would be nearly days using less efficient programming tools. We
have seen one poster, I forgot her name,
whose program needs several days to fulfil its task and I'm aware of
programs which have to run even longer.

Apart from all the currently development of the language itself, I
indeed miss something in C++ ;-):
Necessary language support for multithreading programming (Luckily there
are know severe steps in that direction)
and support for meta classes with all its follow-up's (e.g. virtual
static functions).

Finishing this contribution I can say that C++ is the best computer
language I have worked with.

Greetings from Bremen,

Daniel Krügler

Sjoerd A. Schreuder

unread,
Apr 21, 2005, 9:46:25 AM4/21/05
to
Scott Meyers wrote:
> why do you choose to program in C++?

* Strict typing
* Templates (code reuse that doesn't conflict with strict typing)
* RAII
* Containers and shared_ptr<> (close enough to GC to be usable)
* C++ provides every abstraction level I need (to a certain level,
as "A Word clone" isn't understood by C++ compilers (yet?) ;-) ).
* The language never gets into the way (C++ doesn't force me to
use "The Only Right Way (tm)")

With respect to that last reason: I've programmed in Java/J2EE
and Delphi as well, but in both languages I frequently get a feeling
that the language is forcing me to do things less elegantly than
I would like to (and than I'm used to). I don't like the casting
that containers of Object force me to, and the many try {}
finally { foo.close(); } I don't like either.

Most of the above are personnal. I'm more than happy to recommend
Java, Delphi, or any other language when I think that language
is better suited for the job (especially GUI and small webservices
are the weaker points of C++). But at the same time, I hope that
a co-worker will get that assignment, leaving the C++ to me.

Sjoerd

Derek Ross

unread,
Apr 21, 2005, 12:50:11 PM4/21/05
to
Scott Meyers wrote:
> given that there are many
> languages to choose from, why do you choose to program in C++?

Here's my semi-joking answer:

Because if I want to read a double floating point number 'd' from stdin,
in C++ all it takes is:

cin >> d;

But in Java I have to do this:

BufferedReader br = new BufferedReader(
new InputStreamReader(System.in), 1);
String s = (br.readLine()).trim();
d = Double.parseDouble(s);


Derek.

Chris Croughton

unread,
Apr 21, 2005, 9:55:29 PM4/21/05
to
On 21 Apr 2005 04:55:57 -0400, Scott Meyers
<Use...@aristeia.com> wrote:

> 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 :-)

Heh.

> 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.

Well, in my case C# is totally useless for most of the work I do, since
I rarely program for a MS platform at all (when I do I use Cygwin so my
existing Unix-based code can be 'ported' without doing much apart from
recompiling, or occasionally Borland because that's what a customer uses).

Java, in spite of as being controlled by Sun, has fragmented so that
it's not even compatible with itself. Or possibly because it's
controlled by a single supplier who have no problem in just bringing out
a new and incopatible specification. Plus it's horribly slow (ever
tried configuring a Solaris box? Many seconds just to get a new text
menu!).

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

When the responses seem to have stopped, any chance of a summary (the
reasons and possibly the number / fraction of people who said each one)?
It would be easier to follow than trying to remember the ones posted...

Chris C

Scott Meyers

unread,
Apr 22, 2005, 7:51:26 AM4/22/05
to
On 20 Apr 2005 22:31:45 -0400, Branimir Maksimovic wrote:
> I guess for same reason Sun's hotspot java vm is implemented
> in c++, rather then java :)

Is this really true? If so, it's very funny. Is there a URL to back this up?

Scott

Pedro

unread,
Apr 22, 2005, 10:17:05 AM4/22/05
to
Because if you program in C++ all your wildest dreams will come true.

And because girls only want boyfriends who have great skills.

And because I love technology.

-Pedro

Anand Hariharan

unread,
Apr 22, 2005, 10:14:19 AM4/22/05
to

Scott Meyers wrote:
> 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 have spent a not-insignificant portion of my life trying to
learn C++, and I am guilt-ridden that I should justify that time.

Because it blows my ego away that, despite all the time I have spent, I
still feel C++ illiterate, and naively believe that spending some more
time programming in C++ will get me somewhere.

Because I haven't cried sour grapes yet.....

- Anand

CrayzeeWulf

unread,
Apr 22, 2005, 10:25:21 AM4/22/05
to
ka...@gabi-soft.fr wrote:

> So do Pascal and Basic.
>

Hi Kanze,

Thanks for pointing it out. However, I am not implying that I do not use
other languages. As Scott requested, the goal is not to start a C++
love-fest or start dumping on other languages. My reasons were for the
cases when I do choose C++ over other languages and the reasons should be
considered collectively not one at a time.

> Regretfully, the C++ standard is about as relevant if you are
> programming in C++ as the Pascal standard is for Pascal, or the
> Basic standard for Basic.

The C++ standard is extremely relevant for me on a daily basis. When I am
programming, the C++ standard is always open and ready for reference. For
example, any time I see any behavior that I do not understand I look for
the expected correct behavior in the standard. Any time I need to refer to
the use of the STL, I go straight to the standard.

> To date, only one vendor (EDG) has
> bothered to implement it; apparently, the others just don't
> care.

I do not think that others do not care. The implementation of the complete
standard is a very difficult task especially if your compiler has evolved
since times before the C++ standard came into being. I am sure that all
major vendors are making efforts to implement the complete standard. MSVC++
has made major strides in since V6. G++ has too since the v2.95 days. I am
sure that they will get better and better with every new release.

Thanks,
--
CrayzeeWulf

Ketan

unread,
Apr 22, 2005, 10:06:34 PM4/22/05
to
Hi,

I had used C for 4 years and liked it a lot.

Then used C++ for building ray tracer and i am amazed at ease of use
and flexibility. Before using also, I knew and used C++ but not as
primary language.

So from newbie perspective
1) extensive standard libary and compiler support.
2) Lot of online help and resources
3) Highly expressive...

bye
Ketan

ka...@gabi-soft.fr

unread,
Apr 22, 2005, 10:13:58 PM4/22/05
to
Daniel Krügler (ne Spangenberg) wrote:
> Hello James Kanze and Scott Meyers,

> ka...@gabi-soft.fr schrieb:

> >CrayzeeWulf wrote:

> >>Because of the following primary reasons:

> >>1. It has a standard (that is not controlled by a single
> >> corporation).

> >So do Pascal and Basic.

> >Regretfully, the C++ standard is about as relevant if you are
> >programming in C++ as the Pascal standard is for Pascal, or
> >the Basic standard for Basic. To date, only one vendor (EDG)
> >has bothered to implement it; apparently, the others just
> >don't care.

> Strictly said that is true, but we have to see two sides of the coin:

> 2) While 100% standard conformance of C++ is rarely found,


> most current compilers support at least 90% of it. So the
> C++ standard is in many points heading the implementations.
> Please don't misunderstand that statement: I don't think
> that the standard development is **too** quick for
> implementors. Of course there exist also language
> extensions, but I rarely need them (If I use them, than
> just because our programming guide demands it). Some of
> them are needed in low level parts (e.g. alignment
> issues), but many (most?) programs don't need them.

Being somewhat of an optimist, I still hope that that the
standard will contribute to portability, in the end. For the
moment, however, I can only constate that it has done more harm
than good. There was a working subset of C++ which was portable
before the standard, and that subset wasn't that much smaller
than what is portable today. In the meantime, a lot of the code
which worked with that subset doesn't work with all compilers
today.

> 3) Viewing at Pascal (I cannot say much concerning the Basic


> standard, although I wrote my first computer program in
> Basic), its standard is totaly behind reality, to my
> opinion. AFAIK Object Pascal has no ISO standard (I would
> like to hear news concerning that point), and one of the
> most popular implementations, Delphi, are quite good to
> use, but the lack of portability is not so nice.

My point was just that a standard isn't worth much if it is
ignored by the vendors. The Pascal standard was ignored by all
of the vendors when it was current, as was the Basic standard.
So the standard didn't help portability.

I still have hopes for the C++ standard, but for the moment,
we're not there yet.

> When I started programming with C++ I started to program in a
> portable way and tried careful to be as compliant as possible.
> Interestingly the C++ standard is very importand for my daily
> programming, while a similar need/wish of compliance to a
> standard of other languages cannot be found (at least not in
> my direct environment). I assume the reason is, that most
> programmers of very "lightweighted" languages (w/o, templates,
> w/o multiple inheritance,...) are not interested in
> comformance and do program using a very specific vendor, for a
> very specific OS, etc.

I wrote a lot of "portable" C before I turned to C++. Even
today, there's a lot of C around which tries to be portable.
(G++ is written in C, for example.)

Of course, both in C and in C++, portability is limited by the
fact that there are so many things the standards don't address,
like sockets or threading, that are needed in real programs.
Curiously, I've not found this a great problem with regards to
portability. Even in C, I'd create a library with a common
interface and differing implementations.

> Especially in the beginning I was amazed that it is possible
> to develop a program under a given OS, compiler, library and
> so on, than providing this program to another guy at a totally
> other OS, compiler, etc and it worked!

It depends on what the program does. Try something with threads
or sockets, and then port from Unix to Windows:-).

[...]


> Furtheron are the rules of object construction and destruction
> simply amazing and allow very important idioms as RAII, which
> provide an excellent way of flow control.

This is probably the most important "invention" in C++. In
fact, I don't know whether Stroustrup invented the idea, or
whether other languages implemented it first, but I do know that
in no other language has it become such an important idiom. It
certainly didn't influence my choice of C++ to begin with -- in
1990, I don't think many people realized how important it was --
but it is definitly something I look for when choosing a
language today.

But of course, as I pointed out in my earlier post, the people
who actually choose the language generally don't understand this
sort of detail:-).

> Up to now I didn't mention the fact, that C++ also allows
> highly performant programs.

So do other languages. At least on some platforms. Under
Windows, for some types of applications, Java runs faster than
C++.

> This is also a very important reason for me to use this
> language. I still do hourly long calculations of molecular
> spectra but these hours would be nearly days using less
> efficient programming tools. We have seen one poster, I forgot
> her name, whose program needs several days to fulfil its task
> and I'm aware of programs which have to run even longer.

Many of the programs I've worked on run for years:-). But I
don't think you mean it in that sense.

> Apart from all the currently development of the language
> itself, I indeed miss something in C++ ;-): Necessary language
> support for multithreading programming (Luckily there are know
> severe steps in that direction) and support for meta classes
> with all its follow-up's (e.g. virtual static functions).

> Finishing this contribution I can say that C++ is the best
> computer language I have worked with.

For some definition of best, I could agree.

I have a small problem right now: I have to remove the accents
from a short bit of text. For that job, C++ is not the best --
I'll use Borne shell and tr.

Just to say that I really don't think that there is a best.

--
James Kanze GABI Software
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Bronek Kozicki

unread,
Apr 22, 2005, 10:33:21 PM4/22/05
to
Scott Meyers <Use...@aristeia.com> wrote:
> On 20 Apr 2005 22:31:45 -0400, Branimir Maksimovic wrote:
>> I guess for same reason Sun's hotspot java vm is implemented
>> in c++, rather then java :)
>
> Is this really true? If so, it's very funny. Is there a URL to back
> this up?

Looking closely (i.e. imported libraries and symbols, strings in a file)
at jvm.dll it's quite obvious, if you have Java runtime installed.
Besides, what would execute JVM if it were implemented in Java?


B.

Graeme Prentice

unread,
Apr 22, 2005, 10:32:36 PM4/22/05
to
On 22 Apr 2005 07:51:26 -0400, Scott Meyers wrote:

>On 20 Apr 2005 22:31:45 -0400, Branimir Maksimovic wrote:
>> I guess for same reason Sun's hotspot java vm is implemented
>> in c++, rather then java :)
>
>Is this really true? If so, it's very funny. Is there a URL to back this up?
>


Well there's this one
http://www.jroller.com/comments/slava/Weblog/the_hotspot_source_code_is#comments

written by Slava Pestov, who has become highly critical of Java, despite
writing the much respected JEdit editor in Java. He did an amazing job
considering he started at the age of around 14 and is still at
university.

He's currently creating a "Forth" like language called Factor that uses
postfix notation (proponents claim you get used to postfix).

I use C++ because it's one of the few languages suitable for embedded
work - better than C in my opinion. Unfortunately the learning curve
seems a little high for it to become widely used in the company I work
for where mostly C is used for embedded software and does the job
adequately.

Graeme

Paul Rosen

unread,
Apr 23, 2005, 5:19:04 AM4/23/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++?

Our company survived off of a DOS product in the early 90's written in
C. We had a couple of C experts.

We needed to rewrite it for Windows 95 and knew we needed to go OO.

C++ came for free with the compiler that our particular compiler vendor
supplied.

We knew we needed to "tool up" on OO, but we needed to be immediately
productive, so compatibility with C was important.

Our product has a section with high performance demands, and we
understood how to write really efficient C code, so that section would
be in C.

Java and C# were not invented yet.

---

Now, we have a huge heap of C++ code, and have some programmers who know
C++. It would be hard to change.

If C++ didn't serve our purposes, we might consider making a leap, but
it does just fine, so what would we gain from Java besides the job
security from a huge rewrite?

david...@ed.tadpole.com

unread,
Apr 23, 2005, 5:18:19 AM4/23/05
to
Robert Kindred wrote:
>
> 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.
<snip>

You're close enough to these coders to see what they're doing but not
close enough to determine the language they're using?! The version of
Office installed makes no difference to the verison of Visual Basic
you're using. Presumabely, you're referring to VBA?

igivanov

unread,
Apr 23, 2005, 5:20:22 AM4/23/05
to

Scott Meyers wrote:
> 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.

In my case, I chose (though I work for a company, it was my choice, as
there were alternatives) C++ for certain software because
- it's non-proprietary and widely spread;
- the software it's used for was originally and still has parts written
in C, so it is relatively easy to continue in C++;
- it has enough features for the purpose.

Not because I love or like it, because I don't :-). ("Tolerate" is the
most appropriate word.)

I also use other languages where they are more suitable.

Igor

david...@ed.tadpole.com

unread,
Apr 23, 2005, 5:15:41 AM4/23/05
to
Russell Hind wrote:
<snip>
>
> 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.
>
<snip>

I'm not sure about Java but C# allows the creation of user-defined
value types that are stack-based and so share the simple deterministic
destruction of C++ stack-based objects.

Cheers,

Dave

Branimir Maksimovic

unread,
Apr 23, 2005, 5:16:38 AM4/23/05
to

Scott Meyers wrote:
> On 20 Apr 2005 22:31:45 -0400, Branimir Maksimovic wrote:
> > I guess for same reason Sun's hotspot java vm is implemented
> > in c++, rather then java :)
>
> Is this really true? If so, it's very funny. Is there a URL to back
this up?
>
> Scott

It's true you can download source code from
http://java.sun.com/j2se/1.5.0/download.jsp

Greetings, Bane.

Mary K. Kuhner

unread,
Apr 23, 2005, 1:18:58 PM4/23/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 don't
>care if the reaons are technical, political, social, or what, I'm just
>honestly curious.

I write programs for biologists to use. This means I have
to deal with the wide diversity of OSes and compilers in use
by biologists worldwide, so I need a language which is
well standardized, widely available, and not OS-specific.

My applications are numerically intensive, so I need a
language which is fast and has decent numeric support.

The programs are pretty big. Their predecessors were in
C and became too complex for me to easily maintain or
upgrade. C++ has been very helpful in taming the complexity;
changes that took weeks in C often take only hours in
C++. This could be done in other langauges, even in C
with very careful coding, but it was easier to do it in
a language with strong support for polymorphism and
information hiding.

The first point above rules out C#, the second rules out
Java, the third rules out (in my hands) Fortran and C--
not too many options are left.

Mary Kuhner mkku...@eskimo.com

Anand Hariharan

unread,
Apr 23, 2005, 1:21:54 PM4/23/05
to
Don't know if you consider this URL as one that would "back this up":

http://www.research.att.com/~bs/applications.html

- Anand

Ben Hutchings

unread,
Apr 23, 2005, 1:24:00 PM4/23/05
to
Derek Ross wrote:
> Scott Meyers wrote:
>> given that there are many
>> languages to choose from, why do you choose to program in C++?
>
> Here's my semi-joking answer:
>
> Because if I want to read a double floating point number 'd' from stdin,
> in C++ all it takes is:
>
> cin >> d;

Plus error-checking!

> But in Java I have to do this:
>
> BufferedReader br = new BufferedReader(
> new InputStreamReader(System.in), 1);
> String s = (br.readLine()).trim();
> d = Double.parseDouble(s);

Of course, it can work the other way too:

std::stringstream ss(s);
if (!(ss >> d and ss.eof()))
throw ???;

vs

d = Double.parseDouble(s);

--
Ben Hutchings
Having problems with C++ templates? Your questions may be answered by
<http://womble.decadentplace.org.uk/c++/template-faq.html>.

Llewelly

unread,
Apr 23, 2005, 1:21:24 PM4/23/05
to
ka...@gabi-soft.fr writes:

> CrayzeeWulf wrote:
> > Because of the following primary reasons:
>
> > 1. It has a standard (that is not controlled by a single
> corporation).
>
> So do Pascal and Basic.
>
> Regretfully, the C++ standard is about as relevant if you are
> programming in C++ as the Pascal standard is for Pascal, or the
> Basic standard for Basic. To date, only one vendor (EDG) has
> bothered to implement it; apparently, the others just don't
> care.

Fortunately, not every code base needs to support MSVC 6.0, gcc 2.7.2,
or sun 4.2 .

Llewelly

unread,
Apr 23, 2005, 1:22:16 PM4/23/05
to
Scott Meyers <Use...@aristeia.com> writes:

> On 20 Apr 2005 22:31:45 -0400, Branimir Maksimovic wrote:
> > I guess for same reason Sun's hotspot java vm is implemented
> > in c++, rather then java :)
>
> Is this really true? If so, it's very funny. Is there a URL to
> back this up?

The favorite ref for this is:
http://www.research.att.com/~bs/applications.html
and search for 'hotspot' .

Also: http://www.usenix.org/events/jvm01/full_papers/russell/russell_html/
and search for 'since the HotSpot JVM is implemented in C++'

I think both of these date back to at least 2001, so it's concieviable
that the hotspot jvm has been re-implemented in some other
language, but I couldn't find any claim to that effect.

The source is availible at sun's download site, so you could go look
for yourself (something I haven't done), though I suggest you read
the SCSL 2.3 before doing so. I can't give a link because it
requires registration and click-through and so forth.

Ben Hutchings

unread,
Apr 23, 2005, 1:23:21 PM4/23/05
to
Scott Meyers wrote:
> On 20 Apr 2005 22:31:45 -0400, Branimir Maksimovic wrote:
>> I guess for same reason Sun's hotspot java vm is implemented
>> in c++, rather then java :)
>
> Is this really true? If so, it's very funny. Is there a URL to
> back this up?

The source is available under SCSL, so you could check for yourself.
I read a blog entry that stated it was a mixture of C++ and Java.
Google for "sun hotspot source" and you should find both.

--
Ben Hutchings
Having problems with C++ templates? Your questions may be answered by
<http://womble.decadentplace.org.uk/c++/template-faq.html>.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]

Bo Persson

unread,
Apr 24, 2005, 5:12:13 AM4/24/05
to

"Bronek Kozicki" <br...@rubikon.pl> skrev i meddelandet
news:6ac9f$42690604$53f487c2$17...@nf1.news-service.com...

> Scott Meyers <Use...@aristeia.com> wrote:
>> On 20 Apr 2005 22:31:45 -0400, Branimir Maksimovic wrote:
>>> I guess for same reason Sun's hotspot java vm is implemented
>>> in c++, rather then java :)
>>
>> Is this really true? If so, it's very funny. Is there a URL to back
>> this up?
>
> Looking closely (i.e. imported libraries and symbols, strings in a
> file)
> at jvm.dll it's quite obvious, if you have Java runtime installed.
> Besides, what would execute JVM if it were implemented in Java?

But the fun thing is that some people choose Java because it is supposed
to be more portable than other languages, as it runs on more systems.
You just have to port some other compiler first, to compile the JVM...


Bo Persson

Seungbeom Kim

unread,
Apr 24, 2005, 5:10:52 AM4/24/05
to
Graeme Prentice wrote:
> I use C++ because it's one of the few languages suitable for embedded
> work - better than C in my opinion.

I'm glad to see such an opinion of yours. Unfortunately, I have seen lots
of people who were anxious about the additional runtime overhead and code
bloat that C++ might incur. I believe they're not significant and that
they're just what you pay for what you actually need and use, but they
just wouldn't be convinced. What arguments could you present to those who
have such vague and groundless suspicions?

--
Seungbeom Kim

Dave Harris

unread,
Apr 24, 2005, 5:22:17 AM4/24/05
to
Use...@aristeia.com (Scott Meyers) wrote (abridged):

> Here, I'm not interested in why one MIGHT choose C++, I'm interested
> in why people DO choose C++.

Because I couldn't get a job in Smalltalk. Although my position is now
stable, I'd be sorely tempted to quit C++ if someone offered me a job in
any of the interesting languages - by which I mean the likes of Smalltalk,
Haskell, O'Caml, Eiffel, Dylan, etc. I suspect many people use C++ because
they are ignorant of the alternatives, thinking there is nothing better
than Java or C#.

My employers use C++ partly from inertia. We have a lot of C and C++
source code which would be too costly to convert. I am not a fan of
multi-language projects, not if code in all the languages needs to be
maintained (linking to 3rd party libraries is another matter).

A benefit of C++ is that we know it works reasonably well for a variety of
code. We still use a bit of assembler for the really low-level stuff. I
think most of my colleagues don't make much use of templates, or even RAII
or exceptions, so those are not killer features for us. (I use them, but
I'm the local C++ guru.) Our new hires claim to know C++, but I don't know
how important that is. I suspect it would be quicker to teach all of
Smalltalk than to teach the bits of C++ they don't know.

The standard is only important insofar as it represents a better language.
If our vendor implements a new feature, generally I'll start to use it if
it is in the standard, and I won't if it isn't.

If I were starting a new company, building the source code base from
scratch, I probably wouldn't pick C++. It's too complex and too verbose
and too compromised.

-- Dave Harris, Nottingham, UK.

Beman Dawes

unread,
Apr 24, 2005, 5:21:10 AM4/24/05
to

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

> 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.

That is very important to me, too. I'm old enough to have had to throw away
too much perfectly good software because it was written in languages tied to
one vendor, and that vendor disappeared or stopped supporting it. I never
want to do that again.

C++ is, in effect, an open source language. The mechanism (the standards
committee) is clunky compared to a lot of open source software projects, but
the key point is that users have significant input into the language and
standard library. If you look at the library TR just voted in, almost all of
it came from the user community. Many of the enhancements proposed for C++0x
are coming from the user community. Every defect report, and many of these
come from users, gets airtime. That's a ray of light compared to the
darkness that surrounds the process for most other languages.

--Beman

Russell Hind

unread,
Apr 24, 2005, 5:17:33 AM4/24/05
to
david...@ed.tadpole.com wrote:
>
> I'm not sure about Java but C# allows the creation of user-defined
> value types that are stack-based and so share the simple deterministic
> destruction of C++ stack-based objects.
>

Isn't that new in .Net 2.0? IIRC, doesn't the compiler just internally
generate these on the managed heap, call the 'constructor' and when it
goes out of scope, call the destructor but still leaves the memory lying
around for the GC to clean up in its next pass. I may be wrong here,
but that is what I understand.

Cheers

Russell

Andrei Alexandrescu (See Website For Email)

unread,
Apr 24, 2005, 5:27:25 AM4/24/05
to
ka...@gabi-soft.fr wrote:
> Daniel Krügler (ne Spangenberg) wrote:
>>Furtheron are the rules of object construction and destruction
>>simply amazing and allow very important idioms as RAII, which
>>provide an excellent way of flow control.
>
>
> This is probably the most important "invention" in C++. In
> fact, I don't know whether Stroustrup invented the idea, or
> whether other languages implemented it first, but I do know that
> in no other language has it become such an important idiom. It
> certainly didn't influence my choice of C++ to begin with -- in
> 1990, I don't think many people realized how important it was --
> but it is definitly something I look for when choosing a
> language today.

Yah, by the way, is there some history to this idea? I, too, think that
the way C++ value semantics work is very interesting and innovative - at
a time when all other languages were either oriented towards
"identity-less" references.

If only the system would have caught some more things:

1. Transfer semantics (differentiating between an ordinary copy of a
value and the last statically-known copy of a value);

2. Overloading of constructors based on creation of constant versus
mutable values;

3. Post-ctors/pre-dtors (the ability of invoking of a function right
after full-object construction and right before full-object
obliteration); and

4. More robust ways to avoid slicing of polymorphic objects.

...then I would have said that really the system approaches perfection.
It breaks my heart to think of those. Fortunately, it's very likely (1)
will be addressed in the next iteration of the standard, which makes me
feel a little better :o).


Andrei

Branimir Maksimovic

unread,
Apr 24, 2005, 5:26:15 AM4/24/05
to
Ben Hutchings wrote:
> I read a blog entry that stated it was a mixture of C++ and Java.
> Google for "sun hotspot source" and you should find both.

No; surprisingly hotspot jvm is written entirelly in c++ even assembler
classes.
Support libraries are written in java with some help from c (when
native
libs are needed).

this is found from hotspot source tree (support libs are other project
which is almost pure java)

[bmaxa@maxa ~/java/hotspot] $ find . -name '*.java'|wc -l
15
[bmaxa@maxa ~/java/hotspot] $ find . -name '*.cpp'|wc -l
656
[bmaxa@maxa ~/java/hotspot] $ find . -name '*.hpp'|wc -l
711
[bmaxa@maxa ~/java/hotspot] $ find . -name '*.c'|wc -l
9
[bmaxa@maxa ~/java/hotspot] $ find . -name '*.h'|wc -l
20

Greetings, Bane.

Ben Hutchings

unread,
Apr 24, 2005, 5:25:53 AM4/24/05
to
david...@ed.tadpole.com wrote:
> Russell Hind wrote:
><snip>
>>
>> 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.
>>
><snip>
>
> I'm not sure about Java but C# allows the creation of user-defined
> value types that are stack-based and so share the simple deterministic
> destruction of C++ stack-based objects.

These value types are basically like POD structs - they don't have
destructors (or any of the other abstraction features that classes can
have). C# does support determinstic destruction through the "using"
keyword, but it is the responsibility of the client, not the class
author, to use it.

--
Ben Hutchings
Having problems with C++ templates? Your questions may be answered by
<http://womble.decadentplace.org.uk/c++/template-faq.html>.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]

Brian Riis

unread,
Apr 24, 2005, 5:24:09 AM4/24/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.

Well, because it gives me a 'legal' excuse to read Hyslop's and Sutter's
"Conversations" column in CUJ.

No, jokes aside (although I *do* enjoy reading that column every month),
C++ was sorta a no-brainer when I started to learn to program in the mid
'90s. I had an Amiga, and the "natural" language there was C. Several OO
alternatives came along, but since everyone else I knew also had IBM
PCs, switching to an OO-language really meant choosing between an
Amiga-specific language or C++. Java was a no-op because of the
extremely poor support on the Amiga back then.

So C++ it was, and I've really just tagged along since then. What amazes
and intrigues me most, are the endless possibilities for expressing a
solution to some problem in this language. The language keeps expanding
under my feet, even though nothing about it really changes (well ok, TC1
and TR1 has come along). But to see the things that seem possible today
using only the same old language constructs, compared to what "was
possible" back in the just-pre-standard C++ days is simply amazing, and
I'm gonna stick around C++, if only to see what will be possible in 5 years.

Yep, I'm overexcited and jittery, and likely quite reckless, and I love it!

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

--
/Brian Riis

Sengan Baring-Gould

unread,
Apr 24, 2005, 11:29:28 AM4/24/05
to
Why do I use C++ (since I also use Python, Haskell, assembly and C) ?

- Speed (often I use it as a better C, for instance using templates, but
also I might do a full blown object oriented design in C++ but only
where I need speed)

- Compatability with other programmers or the program to which I'm
adding functionality.

Otherwise:

- I'll use Python for object oriented development if I don't need speed
because:
- garbage collection simplifies life
- its syntax is marvelously simple
- it's an interpreted language

Using the interpreter allows one to fix functions while there is live data
in one's program. One program I wrote read in multi-gigabyte files
(the C++ part) to build some basic data structures. Then it did a lot of
data munging, which I wrote in Python. Because the interpreter
was linked in I could fix functions and reload them without rerunning
the multi-gigabyte file analysis (which took 20+ mn).

Sometimes if the Python's too slow I'll map it over to C++.


- I'll use Haskell for algorithm / datastructure development.

- I'll use x86 where needed (speed or size if in an embedded system)


Sengan


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.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]

Francis Glassborow

unread,
Apr 24, 2005, 11:26:44 AM4/24/05
to
In article <1114162553.7...@o13g2000cwo.googlegroups.com>,
ka...@gabi-soft.fr writes

>My point was just that a standard isn't worth much if it is
>ignored by the vendors. The Pascal standard was ignored by all
>of the vendors when it was current, as was the Basic standard.
>So the standard didn't help portability.
>
>I still have hopes for the C++ standard, but for the moment,
>we're not there yet.

There is a distinct difference between ignoring a Standard (as happened
with Basic), ignoring standard compliant implementations (as happened to
a large extent with Pascal) and not actually achieving complete
compliance (which is largely what has happened to C++). Most major
implementors (actually, I think, that is 'all') continue to make efforts
to get closer to the Standard even if most of them have not got there
yet.

BTW, a close inspection of even extremely good implementations of the
original C Standard would reveal some lack of conformance (in
particular, most implementations have problems with some aspects of
floating point implementation though these are often subtly and only of
interest to numerical experts).


--
Francis Glassborow ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects

Seungbeom Kim

unread,
Apr 24, 2005, 11:44:01 AM4/24/05
to
Bo Persson wrote:
> "Bronek Kozicki" <br...@rubikon.pl> skrev i meddelandet
> news:6ac9f$42690604$53f487c2$17...@nf1.news-service.com...
>>Scott Meyers <Use...@aristeia.com> wrote:
>>>On 20 Apr 2005 22:31:45 -0400, Branimir Maksimovic wrote:
>>>> I guess for same reason Sun's hotspot java vm is implemented
>>>>in c++, rather then java :)
>>>
>>>Is this really true? If so, it's very funny. Is there a URL to back
>>>this up?
>>
>>Looking closely (i.e. imported libraries and symbols, strings in a
>>file)
>>at jvm.dll it's quite obvious, if you have Java runtime installed.
>>Besides, what would execute JVM if it were implemented in Java?
>
> But the fun thing is that some people choose Java because it is supposed
> to be more portable than other languages, as it runs on more systems.
> You just have to port some other compiler first, to compile the JVM...

Whenever I hear someone say "Java is platform-independent," I feel a
strong urge to quote a passage from Bjarne Stroustrup's FAQ:

_Java isn't platform independent; it is a platform._ Like Windows, it is a
proprietary commercial platform. That is, you can write programs for
Windows/Intel or Java/JVM, and in each case you are writing code for a
platform owned by a single corporation and tweaked for the commercial
benefit of that corporation. [...]

(from http://www.research.att.com/~bs/bs_faq.html)

--
Seungbeom Kim

Daniel James

unread,
Apr 24, 2005, 4:20:18 PM4/24/05
to
In article news:<MPG.1cccf8dfd...@news.hevanet.com>, Scott Meyers
wrote:

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

That's a no-brainer, on at least some levels. I can do everything in C++
that I can do in either of those others (and more) ... so why would I
choose one of them?

In fact, although I think of myself as primarily a C++ programmer, my
current work is in Java because my client is using JVM-based server
frameworks (Tomcat, JBoss, and the like) and Java is the obvious choice in
that environment.

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

The first language I used was Algol68, in 1974. I was already using and
familiar with user-defined types and operator overloading, and with dynamic
data allocation and the difference between stacks and heaps, etc., while
most people I worked with were using Fortran (and the department I worked
in was recommending 'pidgin' Fortran -- a kind of Fortran II with anything
that might be non-portable removed).

When I was first exposed to microprocessor-based systems I used Pascal (and
assembler, of course) because that was the only high-level language to
which I had access. When I got my hands on a C compiler I started using
that.

>From that point my work was almost entirely based on pcs (small letters,
initially it was z80 and 8085 systems running CP/M-80) and Algol68 was no
longer available to me, but when Walter Bright's Zorland/Zortech C++ became
available I got a copy of that, read Bjarne's book, and started to use it.
I was familiar with the idea of classes because I'd seen PascalPlus, and
was already writing quite object-oriented C code, but having language
support for classes and (virtual) inheritance was liberating. It was
suddenly possible to express OO concepts much more clearly and concisely
than in C. This was the first language I'd used that exceeded Algol68 in
expressiveness (even if it doesn't let you define new operator symbols
<smile>).

When Java first appeared I took a look at it. I remember buying one of the
Sun-sponsored books that had a CD in the back and writing a few little
applications and applets to see what all the fuss was about. I *still*
don't know what all the fuss was about ... Java is a nice enough little
language with no more than its fair share of irritating foibles, but there
is nothing new there. I'm happy enough using Java, and it makes sense for
some projects, but it wouldn't ever be my first choice (perhaps that's
because the things for which Java makes most sense aren't the sorts of
projects that most interest me?)

I don't mean to suggest that I'd automatically pick C++ for every project
but -- other things being equal -- I see no reason NOT to when the project
calls for a language that C++ (or Java or C#) is well-suited to.

I'm sure there are applications for which a completely different language
is a better fit -- I've used things like Prolog and SNOBOL in the past, and
they address completely different sets of problems -- but for the class of
problems that lend themselves to an OO solution C++ seems to me to be as
good a tool as is currently available.

As with any sharp tool it requires care in use ... but blunter tools still
require care, and don't cut so well.
--
Daniel James | djng
Sonadata Limited, UK | at sonadata
| dot co dot uk

Graeme Prentice

unread,
Apr 24, 2005, 4:22:20 PM4/24/05
to
On 24 Apr 2005 05:10:52 -0400, Seungbeom Kim wrote:

>Graeme Prentice wrote:
>> I use C++ because it's one of the few languages suitable for embedded
>> work - better than C in my opinion.
>
>I'm glad to see such an opinion of yours. Unfortunately, I have seen lots
>of people who were anxious about the additional runtime overhead and code
>bloat that C++ might incur. I believe they're not significant and that
>they're just what you pay for what you actually need and use, but they
>just wouldn't be convinced. What arguments could you present to those who
>have such vague and groundless suspicions?


Yeah, that was my boss's reaction when he found out we were using C++ on
a recent project :). I was quite taken aback because I was expecting
the objection to be based on portability, complexity and resource
issues, rather than performance. However, we didn't use the C++ library
or exceptions and we still used a lot of free/non-member functions -
because it made sense to, not because non-static member functions have
additional runtime overhead or increase in code size, compared with
passing pointers around. I think if you compile C code as C++ you'll
see no difference at all in code size, performance or behaviour. If you
move code into classes that you never have more than one instance of,
you might pay a small penalty in speed and size, depending on the code
and the micro - or you might get a performance improvement if indexed
addressing is faster/smaller than non-indexed.

One of my favourite things was the ability to create type-safe timers
where a milliseconds timer couldn't accidentally be treated as a seconds
timer - it's hard to get the type safety in C where implicit pointer
conversions between different pointer types are legal (probably lint
catches this if you bother to use it and aren't too swamped with
warnings to notice). Another useful thing was RAII for scoped-lock
style semaphores which is much safer than explicit semaphore-release
where a single missed release causes a watchdog restart or worse.
Ambitiously, we were using pre-emptive multithreading. Also useful were
virtual functions, boost-static-assert, encapsulation and a "smart
pointer" class that allowed me to control pointer arithmetic on certain
pointer types that pointed into an externally generated database.

For us, runtime overhead and code bloat were non-issues but I think this
isn't always the case e.g. when using containers and algorithms, but as
you say, you don't pay for what you don't use. You probably know the
inlinability of function object operations in template code gives C++ a
speed advantage over C at the expense of code size.

Scott Meyers can probably tell you a lot more about this than I can as I
think he lectures on this subject ...

Graeme

Michael Yam

unread,
Apr 24, 2005, 4:58:20 PM4/24/05
to
On Mon, 18 Apr 2005 05:08:51 -0400, Scott Meyers <Use...@aristeia.com> wrote:

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

Much of my work is in the PalmOS, and C/C++ is the only practical choice. It
wasn't until a year ago that JVMs and the hardware improved enough to be
workable. And even then, Java didn't support all the native Palm UI objects
(e.g.: Palm categories). I could use straight C, and have, but C++ and OOP excel
in managing events, notifications, and UI objects.

C++ does seem to being growing in complexity and weight. There are controversial
areas that have been argued in the forum including the benefits of const
correctness in light of the mutable keyword, and comparisons of exception
handling to a non-local goto. To the extent of the language spec, these features
are optional. But if you work for a company that has set policy to use
exception handling but to, for example, avoid templates, well, then you're
stuck... a side effect of C++'s growing size and how companies are trying to
manage it.

In the end, I echo the sentiments of most of the posters. The reasons I use C++
over other languages can be summarized with 4 "Ps":

1. Power
2. Portability
3. Performance
4. er... ah... Phlexibility ;-)

--
Mike Y.
myam (at) optonline (dot) net

Walter

unread,
Apr 24, 2005, 10:27:52 PM4/24/05
to

"Sengan Baring-Gould" <sen...@gmail.com> wrote in message
news:69e6fce9.05042...@posting.google.com...

> Why do I use C++ (since I also use Python, Haskell, assembly and C) ?
>
> - Speed (often I use it as a better C, for instance using templates, but
> also I might do a full blown object oriented design in C++ but only
> where I need speed)

Here are the results of the great computer language shootout, sorted by
performance:

http://shootout.alioth.debian.org/great/benchmark.php?test=all&lang=all&sort=fullcpu

-Walter
www.digitalmars.com C, C++, D compilers
"code of the nerds"

Rune Allnor

unread,
Apr 25, 2005, 9:17:07 AM4/25/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.

I'm a bit too fresh as a C++ programmer to explain why I program
with C++, but I can answer why I want to program with C++:

- It has been around for along time and is widespread. Tools
are available, quirks are known and understood. C++ is a mature
programming language, what I am concerned.
- It's available on all relevant platforms.
- It is standardized and non-proprietary and thus resistant to
sudden changes.
- It allows me to program in any level of abstraction I choose.
- There are many useful libraries available.

I learned Pascal 17 years ago, ix86 assembly language 15 years
ago, Matlab 14 years ago, C 12 years ago and C++ 10 years ago.
I am not a computer programmer, rather an engineer who programs
computers. I am not very motivated to continue learning a new
programming language every 2-3 years.

To me, the important part is to get the job done in an resource-
efficient way that does not force me to start from scratch if I
have to do something similar later on. Other programming languages
are either too platform or vendor specific (java, C#, various tools
under UNIX/Linux), or too heavy on resources (matlab).

To me, C++ is the only programming language left to consider.

Rune

It is loading more messages.
0 new messages