views:

179

answers:

6

Possible Duplicate:
in which area is c++ mostly used?

I started off with C in school, went to Java and now I primarily use the P's(Php, Perl, Python) so my exposure to the lower level languages have all but disappeared. I would like to get back into it but I can never justify using C over Perl or Python. What real-world apps are being built with these languages? Any suggestions if I want to dive back in, what can I do with C/C++ that I can't easily do with Perl/Python?

A: 

C/C++ can be, and is, used for nearly all "types" of programs.

There are some major advantages to C and C++:

  • Potentially better performance
  • Easier to build interoperable libraries, especially if working with libraries usable from multiple languages.
Reed Copsey
A: 

well the interpreters for your "P's" languages are most certainly written in c/c++. Most OS code is written in C/C++. On the application side, if you are into games, they are generally written in c/c++. Anything that needs high performance and or low memory is a good candidate.

I've used Gsoap, a c++ soap client implementation for a web service that got HUGE traffic.

Byron Whitlock
"My compiler compiled your compiler" ?
Kate Gregory
@Kate Gregory: And just to confuse things, you should write a C compiler in Python.
FrustratedWithFormsDesigner
Yeah? Well MY compiler compiled your compiler's compiler! AND your mom!
Carson Myers
My compiler is bigger than yours! .. um.. in a good way.. eh.. bahh! ;)
Marcus Lindblom
+3  A: 

To borrow some text from the answer I had for another related question:

  1. Device drivers in native code.
  2. High performance floating point number crunching (i.e. SIMD).
  3. Easy ability to interface with assembly language routines.
  4. Manage memory manually for extended execution runs.
Amardeep
So basically if I don't need to write any of these I should stick with the languages I'm using now?
Ryan Detzel
Well, they're not an exhaustive list. But if your task at hand is not cumbersome using your language of choice then by all means keep using that language!
Amardeep
#4 should be a reason __NOT__ to use C of all things!
fuzzy lollipop
@Ryan Detzel: "I should stick with" Dude, you should use your brain, think for yourself and pick whatever tool works best for you. Right now you are asking *other people* to tell you what will work best *for you*. This is kinda hard to answer. Try language, get a taste of features, and if it doesn't work for you - don't use it.
SigTerm
Some HLL compilers have SIMD support, and some LLL compilers don't. I think that's more dependent on your particular compiler and architecture than on the language itself.
Ken
A: 

Most desktop/console applications with a bias toward graphics rely heavily on C++. This includes CAD software and AAA video games, among other things.

TreDubZedd
+2  A: 

Most of my work has been C and C++. I studied computer engineering in school and worked with embedded devices. My Master's degree had an emphasis in graphics and visualization. One of our visualization apps was written in Python, but for the most part, graphics demands C/C++ for the speed. I now work with embedded devices running Windows Mobile and Windows CE - all C++, though you can do a lot with C#. I previously worked in simulations, which was all C++ code on the backend. C++ is still king for time-sensitive IO, embedded applications, graphics and simulations.

Basically, if you need tight control of timing, you go lower level. Or if you need light-weight (ie, small program size, small memory footprint)

Eli
I work in embedded devices as well, and have used C/C++ almost exclusively for these projects.I've used higher-level languages like Ruby and Python for tests and utilities, and my company has used Java for a couple less time-critical embedded projects, but C and C++ are our workhorses.
Maha
+1  A: 

Somewhat unscientifically I took a look on Sourceforge and the top twenty projects/language break-down is currently thus:

  • Java(43,199)
  • C++(34,313)
  • PHP(28,333)
  • C(26,711)
  • C#(12,298)
  • Python(12,222)
  • JavaScript(10,307)
  • Perl(8,931)
  • Unix Shell(3,618)
  • Delphi/Kylix(3,353)
  • Visual Basic(3,044)
  • Visual Basic .NET(2,513)
  • Assembly(2,283)
  • JSP(1,891)
  • Ruby(1,731)
  • PL/SQL(1,669)
  • Objective C(1,424)
  • ASP.NET(1,344)
  • Tcl(1,241)
  • ActionScript(1,164)

Perl + Python together still total less than C alone. I have no idea why Java is so high, I know of no single Java developer and have not seen a single Java project, but I am sure someone is using it! For probably the same reason, you are not seeing much C/C++, you are just not working in a domain where it figures highly. I work in embedded systems where C and C++ are ubiquitous and Python comes nowhere. Different languages are encountered to different extents in different worlds.

You ask what you can do with C/C++ that you cannot do easily with Perl/Python; well the answer is plenty, real-time embedded systems for one; but if that is not what/need you want to do, then there is no reason to. On the other hand I might ask the reverse; I'd use C++ for things you might use Python for, simply because for me it would be easier and quicker (than learning a new language and getting the tools working)

Clifford