reason behind gaining popularity of c++ over other programming languages
reason behind gaining popularity of c++ over other programming languages
C++ is the C language with objects (classes, methods, etc). C is often considered a high-level assembler language, able to control the system at a fundamental level. Compilers will turn C/C++ code into very efficient machine (binary) language. So part of the popularity of C++ is its efficiency (speed and code size), its ability to reflect complex class structures that would not be feasible with the C language, its ability to integrate with legacy C code, and its ubiquitous availability for just about every processor architecture and operating system out there. FWIW, I've been using many languages for over 30 years, but my main languages are C (since 1982) and C++ (since 1992). I also code in Java (C++ with training wheels) as well as numerous scripting languages.
I like your description of java rubberman. I fell the same way.
Categorizing C++ as an OOP language is very reductionary. C++ is a multi-paradigm language. C++ was originally motivated by the OOP "revolution", and that played a major part in its original popularity. In modern times though (21st century), the popularity of C++ is mostly driven by what Alexandrescu calls "zero-overhead abstractions", or as Stroustrup puts it "an uncompromising infrastructure language". In other words, C++ is remarkably effective at allowing you to create high-level abstractions with minimal overhead, that is, you don't have to make compromises on the performance in order to construct the kind of complex software designs that are needed in certain complex applications. In large part, this is because it allows you to move very freely between the simple-yet-effective procedural programming style (i.e., C-style POD-types and free functions), the dynamically-flexible object-oriented style, and the highly customizable, zero-runtime-overhead generic programming styles (i.e., the STL), and blend them all at your heart's content.
Today, "competing" languages are sort of stuck in the niche that they dug themselves into. Of course, some high-level languages like Python do not pretend to compete with C++, but rather embrace the complementary role that they can play (i.e., providing simple-to-digest and flexible wrappers for what is mostly C / C++ code running under-the-hood). But others, particularly Java, are pretending to compete with C++, especially in the field of infrastructure programming. They generally rely on arguments of being less complex / easier to learn, on providing more flexibility, runtime safety and portability, and on the idea that hardware is going to improve so fast that compromises in performance will not be a problem in the future (i.e., that was the promise about 15 years ago). They've mostly failed on all accounts, and C++ has weathered the storm and is growing strong, especially in more professional circles.
Java/C# have more or less caugh up to C++ in complexity by successive tacked-on additions to their language and library. Flexibility in a OOP-only style is severely limited and is otherwise often unnecessary, and is often very taxing in terms of programming effort and run-time overhead. Runtime safety is, of course, often desirable (but has its cost), yet the jury is still out on whether Java/C# style languages are really that much safer, if at all.
In modern C++, portability is often merely a matter of re-compiling the code for each different platform (with a bit of tweaking), and is a more deliberate act in terms of choosing libraries and functionalities that will work on all target platforms. On the other hand, portability of virtual machines like JVMs or .NET frameworks hasn't really been delivering the goods as promised, and the amount of features they require often severely limit their portability, and when you start having to write code that must take into account the lack of support for some features on some platforms, you can't really talk about "portability" anymore.
And finally, although hardware has been improving really really fast, the complexity of the software has been growing even faster, and Java/C# style languages just can't deliver anymore. When you can reduce the cost of running a large server farm by 80% just by choosing to write the labor-intensive server-side application in C++ rather than Java, there really isn't much debate to have about it, all language-preference arguments are mute. There are very hard limits to performance with these types of languages, especially in large applications, and thinking that they will catch up is a pipe-dream.
Nevertheless, these languages have their purpose (their niche), they are very nice as simplistic, feature-rich, flexible and somewhat safe-guarded languages to write simple end-user-oriented applications (e.g. GUI apps), but they shouldn't pretend that they can compete with C++ in any other realm (C++ can also be used for end-user-oriented apps, but I have to say that Java/C# wins in that domain, mostly because OOP is very appropriate for this domain and C++'s OOP style is slightly more clumsy (only slightly)).
I would say that the features that are really central to C++'s success are: templates and value-semantics (and thus, RAII). The kind of things you can do in practice with these two features is astounishing, and unparalleled, as far as I know. Most high-level languages have moved away from value-semantics in favor of reference-semantics (mainly for garbage-collection purposes), and by doing so, you lose (1) automatic resource management, (2) almost effortless exception safety, (3) the ability to write truly optimal data structures (in terms of memory usage, layout and performance), and (4) being able to create low-overhead / high-level code. And templates, well, there just isn't anything quite like it out-there. I would say that by the combination of templates and value-semantics there are so many things that you can so easily do and so routinely do in C++ which are virtually impossible to do any other mainstream language that I know of (except for D of course, but that's not mainstream, yet). And experienced programmers that routinely use these features really feel handicapped in other languages which often feel, as rubberman said, like "C++ with training wheels".
More and more people are waking up from their Java pipe-dream in infrastructure programming, more and more people adopt C++ in areas traditionally dominated by C (embedded systems, OS kernel code, hardware drivers, etc.), C++ still vastly dominates in many markets (especially in labor-intensive and/or performance-critical applications), and modern C++ coding practices (and latest standard) really make it a very difficult language to beat as far as "general-purpose languages" go. But of course, who knows what the future holds in terms of revolutionary paradigms or hardware leaps. And, obviously, language features and other inherent qualities are far from being the main factor responsible for language popularity (e.g., think of marketing efforts, pushes into academia, platform-biases (e.g., Objective-C is really popular because it's used for iPhones apps, it's not popular for any other reason), and many other classic profit-driven capitalist tactics (vendor lock-in, selling up new languages to make money on training workshops, etc.)).
hello there. i needed a little help in writing coding for reading multiple lines of data from a .txt file that are seperated by commas.
Student Name, Student ID, Mark ...
i have these GNU macro:
#if defined __GNUC__ #define EVENT [[gnu::weak]] #elif defined __clang__ #define EVENT [[llvm::weak]] #endif #define IS_EVENT_DEFINED(sym) (static_cast<bool>(sym))
these macro works fine. and help me test if ...
APLX is a very complete implementation of the APL programming language from MicroAPL. The company stopped producing it in 2016 and it has been taken over by Dyalog. While Dyalog ...