Use cases for C++

A

Achim Schneider

I recently (6 months ago, that is) started to learn C++ because it's
needed in a significant number of job ads, now find my way around but
utterly lack routine. Besides doing boring exercises like "implement
that and that data structure clean and efficient", I feel that what I
really need to do is some sort of full-fledged (however small) program,
not something abstract. I do know C quite in-depth, though.

However, I can't think of a thing to do where I wouldn't choose Haskell
or Scheme before even considering C++, which may very well be because
my greater expertise in the former ones makes me blind for C++'s
strengths.

So, here's my question: What kind of program/project is C++'s home
turf, where you just can't get around using it on a big scale (that
is, excluding library interfaces and small amounts of generated code)?


PS: No, I'm not trying to start a flame war. I really don't know.
 
E

Erik Wikström

I recently (6 months ago, that is) started to learn C++ because it's
needed in a significant number of job ads, now find my way around but
utterly lack routine. Besides doing boring exercises like "implement
that and that data structure clean and efficient", I feel that what I
really need to do is some sort of full-fledged (however small) program,
not something abstract. I do know C quite in-depth, though.

However, I can't think of a thing to do where I wouldn't choose Haskell
or Scheme before even considering C++, which may very well be because
my greater expertise in the former ones makes me blind for C++'s
strengths.

So, here's my question: What kind of program/project is C++'s home
turf, where you just can't get around using it on a big scale (that
is, excluding library interfaces and small amounts of generated code)?

C++ can be used for just about anything you can think of, but the place
where you more or less have to use C++ (or C, or perhaps Ada) is system
programming or when targeting more "exotic" platforms where the runtimes
needed by more flashy languages do not exist. Or embedded systems where
resources are scarce, or when performance is required (most games are
written in C or C++).
 
M

Matthias Buelow

Achim said:
So, here's my question: What kind of program/project is C++'s home
turf, where you just can't get around using it on a big scale (that
is, excluding library interfaces and small amounts of generated code)?

The one you want to burn most money on. C++ must be the least productive
language I've ever had the displeasure to come across.
On a different note, it's more or less the only choice for portable GUI
applications, because of wxWidgets and Qt, as long as you don't want to
use Java, that is.
If you know Scheme or Haskell well, you will weep.
 
J

Juha Nieminen

Achim said:
However, I can't think of a thing to do where I wouldn't choose Haskell
or Scheme before even considering C++, which may very well be because
my greater expertise in the former ones makes me blind for C++'s
strengths.

One strentgh C++ has over many other languages is that it allows you
to write programs which handle enormous amounts of data, applying
complicated heavy algorithms to them, as efficiently as possible,
consuming as little memory as possible, while still maintaining a fair
level of abstraction and high-quality design in your code.

I may be a bit biased in this subject because I have worked for years
in projects where speed and memory usage were absolute imperatives
(basically the more memory-efficient the program, the larger inputs it
could handle in the same computer, and thus the better). While C++ is
not the perfect language in all possible regards, I have found it to be
excellent for these types of applications.

For some reason the vast majority of programmers don't seem to be the
least concerned about the memory usage of their programs. Sure, most
programs simply don't need to worry about memory usage because they
simply don't handle that much data, and current computers have plenty of
memory. However, when you have to handle humongous amounts of data, then
memory usage optimization steps in big time. And of course if your
program can run the algorithm in 5 minutes rather than 5 hours, all the
better.

The great thing about C++ is that you usually are able to implement
these optimizations while keeping a high level of abstraction and
reusability.
 
J

Juha Nieminen

Matthias said:
C++ must be the least productive
language I've ever had the displeasure to come across.

Then you clearly haven't tried C.

(And don't believe *anything* C hackers will tell you. They are
delusional.)
 
B

Bo Persson

Achim said:
I recently (6 months ago, that is) started to learn C++ because it's
needed in a significant number of job ads, now find my way around
but utterly lack routine. Besides doing boring exercises like
"implement that and that data structure clean and efficient", I
feel that what I really need to do is some sort of full-fledged
(however small) program, not something abstract. I do know C quite
in-depth, though.

However, I can't think of a thing to do where I wouldn't choose
Haskell or Scheme before even considering C++, which may very well
be because my greater expertise in the former ones makes me blind
for C++'s strengths.

So, here's my question: What kind of program/project is C++'s home
turf, where you just can't get around using it on a big scale (that
is, excluding library interfaces and small amounts of generated
code)?


PS: No, I'm not trying to start a flame war. I really don't know.

Have you checked out this list of major C++ applications?

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


Things like telecom, CAD, games, operating systems, compilers,
databases, web servers, and Java VMs :)



Bo Persson
 
C

Carlo Milanesi

Matthias Buelow has written:
C++ is best suited for large system programming projects.
By "large", I mean that requires at least four developers working for at
least four years.
You can try to develop a device driver or a bytecode interpreter.
The one you want to burn most money on. C++ must be the least productive
language I've ever had the displeasure to come across.

Of course you never came across system programming languages.
On a different note, it's more or less the only choice for portable GUI
applications, because of wxWidgets and Qt, as long as you don't want to
use Java, that is.

I think that C++ is not the best language to build portable GUI
application, and needless to say it is not the only one.
GUI application code is not standardized, hasn't tight speed and memory
requirements, and requires quick builds, so C++ doesn't shine for that
purpose.
It is a good language to implement a GUI toolkit (as wxWidgets or Qt),
though.
If you know Scheme or Haskell well, you will weep.

There are many people who know Scheme or Haskell and don't weep when
using C++.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top