Why C++?

Why C++?

Rate This
  • Comments 13

A few weeks ago, I had an opportunity to share a few scenarios where C++ really matters to an internal audience from the field. No demo code or sample projects were reviewed, just the scenarios and first-hand examples.

Why C++?

  • Learn "what those C++ folks" know. Some developers feel a pull towards the preciousssss, C++. Sure, it has a bad rep as being full of pointers and other complexity, but its power is unmistakable. [I a great customized picture of the One Ring with "C++" on the top but cannot use it here L]
  • Application lifecycle support tools. Developers often need to create small extensions, command-line tools, and other bits of code to improve the build process, massage files, control deployment or other process details.
  • Shared code libraries. Libraries provide core functionality (think XML processing, text processing, network communication) to a wide audience. C++ enables fast, efficient and elegant code.
  • Hybrid devices. Embedded devices rely more on C but there is a growing hobbyist community around hybrid devices like the Raspberry Pi that can host programs written with C++. This could be the beginning of SkyNet.
  • Niche applications. Looking for a developer job in the financial markets? Math and C++ are must haves! Many unique applications require advanced science work and some experience with C++.
  • Lively debates about syntax. Debating the finer C++ points of auto, when to use lambdas, brace formatting, and move semantics reinvigorates the soul (and helps influence future standards).
  • Application needs to access native code. C++ is the bridge that links managed code to the rich ecosystem of existing, stable and mature native code including open source libraries like OpenCV, Lucene, Cinder, and FFMpeg.
  • Tuning a managed application. C++ can be used to speed up sluggish managed applications. When the profiler points to managed code that has already been optimized, the best choice might be to let C++ handle it (C++ AMP anyone?).
  • Code maintenance. There is a lot of code out there. Much of it is C and C with classes, but much more is C++ and relies on the flexibility and control of the language.
  • Porting code to a new application. New applications are built from the creaky bones of decades-old legacy applications. C++ developers can decode requirements from old native code and express them in modern C++ or other language.
  • Three letters: M F C. MFC lives!
  • Repackage logic. Native code in existing native apps can be repackaged in C++ for new apps targeting different platforms and form factors.
  • Graphics, graphics, graphics. C++ is the choice for the most immersive graphics experience. Data visualization, bleeding-edge user interfaces, the next Pixar movie...
  • Intense multimedia processing. Sound, images and video gobble up bandwidth. C++ and Visual Studio 2013 makes it easier to optimize this type of code for the best performance.
  • Cross platform development. When an application must be cross platform, C++ is hard to beat. There are differences between compilers, but adherence to the standard goes a long way.
  • Custom device support. Native code is used extensively in device support. Developers use C++ to write device drivers, SDKs and sample applications for stuff like sound input, 3d printers and scanners.
  • Pushing the boundaries of computing. C++ can be found at the heart of many high-performance computing applications. Meteorology, chemistry, physics, visualization, genetics....
  • "It's fun!" –survey respondent, 2013

Do you agree with these scenarios? Did I miss one? Do you have detailed examples for any of these that you would like to share (and get credit for if used in future presentations)?

Drop me a line (ebattali@microsoft.com) or comment below. Thanks!

  • Pure OOP enables better communicating system architecture, where as realistic implementation details effectively consume broader range of paradigms like closures rather than inner classes, currying( functional programming), games rules-engine & assertions (logic programming). Far back dynamic languages had platform-independent multi-paradigm support from PERL onwards. The low-level system support for C-style functional extended with OOP came only from C with classes. Even if new languages with more controlled feature-set targeting native development are born, C++ beginning with its C heritage has the more mature multi-paradigm facility for native development.

  • If I C++ a code library, build type static or dynamic, I am am tied to a particular compiler package, and a build type.  Don't imagine passing around STL containers to a DLL (not with its own RTL; I would not consider using redistributables for any released code so if somehow DLL is using the same RTL and can do this, I won't).  C is easy to get around this.  No black boxes involved. There's a reason linux is C and no C++.

    How long is this C++ parade to last?  C-sharp/dotNet was 10 years.  Talk about black box software.  When it works, it works by some miracle but only if everything is just right and GC is neither too seldom nor too often, and no unforeseen errors occur, and when it doesn't work, well, keep patching until somehow it works most of the time.

    WHat's next?  Anything?  Beyond C++.

  • C++ is widely used in Gaming too... Yet, C# defeated C++ when it comes to the development modules of console gaming stuffs (^_^)

  • C++ is still the king where you need both abstraction and performance. You can write code in it that is as high-level as anything you can write in more "modern" languages, but where C++ shines is that if you don't like the way something performs, you can pop the hood and tweak it yourself.

  • No abi? Unix platforms have a perfectly defined, effectively Standard abi that anyone can implement. You can mix units compiled by clang and gcc on osx  all you want...for instance.  Its windows where there is an abi problem because Microsoft holds at least one patent that stops compiler vendors from implementing their Abi on their own platform. Ms also does not document their abi very well. Don't blame that problem on c++.  If you want to see interesting discussion of the subject, go through the clang developer list where people working to complete clang on windows discuss their issues. Btw. I have spent time working in the Linux kernel over the last few weeks. I'm glad it's not my job to maintain all the primitive code I see there. I particularly love the 'goto' expressions.

  • C++: Speed, size, control and determinism. Everyone forgets the last.

  • Same or better high level abstraction, with far better performance.

  • MFC is quite possibly the most terrible and inconsitent GUI library ever to come into existence. I would not use it as an argument for learning C++, but against it (since knowing C++ increases your chance of having to work with that monster of a library).

  • All valid & good points.

    We want a modern & well supported version of the MFC.

  • Compile-time metaprogramming.

    C++ support for compile-time metaprogramming via templates is beyond anything available in most other languages. With templates, you write code that writes the code that is compiled. :)

  • @Tamás Szelei: What rubbish. MFC was excellent when it first came out; as was WinForms; both technologies have been made redundant by later advances; but that doesn't mean they were badly written in the first place.

  • Meanwhile, offline documentation for Win32 Desktop development under VS2013 is still broken beyond repair.

  • As i knows, C++ is a father of all language .. so we can say .. it's a father ..

Page 1 of 1 (13 items)