real-world apps in C++ (preferably simple)?

This is a discussion on real-world apps in C++ (preferably simple)? within the C++ Programming forums, part of the General Programming Boards category; I'm just wondering what C++ is primarily used for these days (and hoping for simple examples since I'm a noob ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    242

    real-world apps in C++ (preferably simple)?

    I'm just wondering what C++ is primarily used for these days (and hoping for simple examples since I'm a noob but would still like to understand).

    In comparison to languages like Java and VB, I can immediately see C++ being used for complex scientific calculations mainly because of its superior speed.

    But surely there are also some things that businesses might ask programmers to design where C++ would be the appropriate language. I'm just wondering what kinds of things these might be.

    At my current (still unfortunately pretty ignorant) stage, it seems to me like C++ is good where you care about speed but less about portability, interactivity with the web, or pretty interface. VB is good where you care a lot about interface and little about speed. Java is good where you care mainly about portability and interactions with the web.

    If that's the case, then, if a business approaches a software company wanting software solution X, what are simple examples of X such that the software company wants to write the code in C++ rather than something else?

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,273
    At a lot of development houses, C++ is simply the default. Specific examples of applications written in C++ include:

    Photoshop, Internet Explorer, Firefox, all of KDE, Visual Studio, OpenOffice.org, the backend of Amazon.com, Google Chrome, Intel VTune, MySQL, Sun's HotSpot JVM, Doom 3...

    (See a fuller list here: C++ Applications)
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I'm just wondering what C++ is primarily used for these days
    Games and scientific computing. Stuff that really needs the performance.

    Also, very large-scale applications, like your typical off-the-shelf consumer application, or an operating system.

    Here's some examples of real-world C++ applications:
    The application my company makes is an example of scientific computation. We mostly do simulation of radio wave propagation, so we need highest-performance computing.
    C++ probably has the largest part of the Windows OS code, for the OS category.
    Firefox core is written in C++, for the large-scale application category.
    Microsoft Office is written mostly in C++.
    OpenOffice.org is also mostly written in C++.
    Nearly every modern 3d game is written in C++. It's hard to verify this in every individual case, of course, but I would expect 99% of the big games released for consoles and the PC in the last five years to be written primarily in C++.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    917
    According to Stroustrup, the first implementation of the 1-800 phone system was (is?) written in C++.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    A lot of mobile phone software for the higher end market is C++ (or if it's an iPhone, it's most often Objective C, which is a less well-known variant of C with objection oriented add-ons).

    The only exception is the budget phones, where the software is much simpler, and mostly written in C or even assembler for space-saving purposes.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by Aisthesis View Post
    I can immediately see C++ being used for complex scientific calculations mainly because of its superior speed.
    If speed is really an issue, odds are it would be written in FORTRAN
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by ಠ_ಠ View Post
    If speed is really an issue, odds are it would be written in FORTRAN
    Unlikely for modern code. I'd be surprised if gfortran is faster than g++ on the same bit of code, just as an example.

    Sure, if it was written 15-30 years ago, it was probably written in fortran for speed. But todays C or C++ compilers are much better than the ones that existed several years back.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    917
    Some of my physics professors still think that Fortran is faster, but if you walk down the hall to the guys who maintain the super-cluster, they're running C++ code.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  9. #9
    Registered User
    Join Date
    May 2009
    Posts
    242
    ok, looking at Stroustrup's list, confirmed by several posters, we have MS Office. Stroustrup explicitly includes Access on this list, yet when I asked not too long ago about the underlying code for Access, people here claimed that JET was written in Visual Basic. So, I'd be interested in further clarification on that specifically.

    Second, let's just take Word as specific example. What I'm not seeing at my beginner level is how we get from the kind of programs I'm doing (straightforward console applications of whatever kind) to a program like Word.

    Is it something like this: C++ manages the entries in memory as we type various things into the keyboard while using Word, then manages the way the file is saved onto disk. What we see on the screen while using Word is managed by libraries or programs outside of but compatible with C++ (?). Or, stated a bit differently: The underlying processes are governed by the same kind of statements, functions, etc. everyone learns but what's added on to get a graphic interface as seen in Word are libraries like wxWidgets or FLTK--presumably not those specifically in the case of Word, but GUIs separate from C++.

  10. #10
    Registered User Sharke's Avatar
    Join Date
    Jun 2008
    Location
    NYC
    Posts
    303
    Quote Originally Posted by Aisthesis View Post
    ...but what's added on to get a graphic interface as seen in Word are libraries like wxWidgets or FLTK--presumably not those specifically in the case of Word, but GUIs separate from C++.
    I should think the GUI is done through the basic Win32 API or using the MFC....can't see Microsoft using wxWidgets!

  11. #11
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Every program, when finished and linked against all the system libraries, ends up as a mix of languages - if for no other reason, then because the system libraries are a mix of C++, C, and a tiny bit of Assembler. Then you could get libraries written in any number of languages - Delphi? Fortran? ActiveX components in VB? .Net libraries accessed via COM interop or a C++/CLI bridge? Who knows. Since it's all compiled down, or interpreted by some compiled-down VM, the program doesn't really care. It all ends up in machine code being executed.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  12. #12
    Registered User
    Join Date
    Jun 2005
    Posts
    6,640
    Quote Originally Posted by matsp View Post
    Unlikely for modern code. I'd be surprised if gfortran is faster than g++ on the same bit of code, just as an example.
    Stand by to be surprised. If numerical performance is a primary concern, Fortran is still preferred over C++. There are valid reasons that C++ is more popular than Fortran, but performance is not really one of them.

    One of the reasons is that Fortran is significantly more restrictive on things that affect aliasing (eg in C, two pointers pointing at the same thing). This means there are significant optimisation opportunities for a Fortran compiler to optimise numercial performance over arrays that are simply not possible for a C or C++ compiler. The latest C standard introduced the "restrict" keyword to partly bridge this gap, but there are still significant differences in achievable performance.

    gfortran is, as Fortran compilers go, also about middle of the road in terms of optimisation. The gap between gfortran and commercial Fortran compilers, optimisation wise, is much greater than between g++ and commercial C++ compilers.
    Quote Originally Posted by matsp View Post
    Sure, if it was written 15-30 years ago, it was probably written in fortran for speed. But todays C or C++ compilers are much better than the ones that existed several years back.
    While it's true that todays C or C++ compilers are higher quality than in the past, the same is true of Fortran compilers. A lot of the more modern optimisation methods used in C/C++ compilers are applicable to compilers for other languages - and they are used in modern Fortran compilers.

    As I noted above, the Fortran language - by design - allows some optimisations that are not readily available to a C/C++ compiler. Optimising Fortran compilers are also more mature than optimising C/C++ compilers - simply because Fortran has been around longer and numerical performance was a design criterion from day on - although you're correct in noting that the gap is narrowing.

    In any event, the main reason that Fortran is less popular now, relative to C++, is an artefact of education - courses concerned with Fortran are relatively rare, and most such courses still focus on Fortran 77 - which is 30+ years old - or, sometimes, Fortran 90. However, Fortran 90 has been superseded (twice: in 1995 and 2003) and there is also a new Fortran standard currently under development.

    Because of this, most performance comparisons, in practice, that I've seen over the last few years between C++ and Fortran is between a 2000-2005 (or later) vintage C++ compiler and mid 1980s Fortran 77 or - rarer - a mid 1990s Fortran 90 compiler. It's no surprise that Fortran does not fare particularly well in that comparison - although, interestingly it often holds its own. I could also compare a 2006-era Fortran 2003 compiler with a mid 90s C++ compiler, and that the C++ compiler would not exactly shine either. That comparison is equally unfair.

    Other than availability of courses, the most significant technical advantage that C++ has over Fortran is due to support of abstractions and a greater range of third-party libraries. However, since Fortran 90, that gap has been closing. The other advantage of C++ is that, practically, it is easier to find experienced C++ programmers than experienced Fortran programmers.

    Fortran is actually evolving more quickly than C++, ironically because it is less popular - there are fewer vendors and programmers who have to find consensus during the standardisation process. The committees are smaller, with fewer hangers on.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Sunshine, and read this, this, and this before posting again.

  13. #13
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Here is a sample of US job listings that ask for C++.

  14. #14
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by grumpy View Post
    and most such courses still focus on Fortran 77 - which is 30+ years old
    ;_; so true

    we had a FORTRAN 77 compiler and a FORTRAN 2003 book
    Last edited by ಠ_ಠ; 06-12-2009 at 02:41 PM.
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 01:51 PM
  2. Books with Real world exersises
    By Spectrum48k in forum C Programming
    Replies: 2
    Last Post: 05-13-2002, 08:34 PM
  3. Programming Puns
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 44
    Last Post: 03-23-2002, 04:38 PM
  4. So what's the real world like when......
    By student in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 02-15-2002, 03:44 AM
  5. Real World
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 01-25-2002, 08:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21