3 ms·
C++ is indeed a high level language, comparable to, say, C#. Let's enumerate some features that we take for granted in most modern high level languages 1. Type
by bstamour 12y ago
C++ is indeed a high level language, comparable to, say, C#. Let's enumerate some features that we take for granted in most modern high level languages
1. Type deduction (C++ has it)
2. Lambda functions (C++ has it)
3. Support for OOP (C++ has it)
4. Generics (C++ has it)
5. Static typing (C++ has it)
6. Support for functional-style programming (C++ has it)
7. Support for garbage collection* (C++11 has it)
8. A powerful library of data structures and algorithms (C++ has it, and the library is growing very rapidly as well.)
C++ supports pretty much every feature other high level languages support, but the features are opt-in, that is, if you don't use it, you don't pay for it.
*As far as I know, however, no compilers are currently implementing garbage collection. But the language support is there already.
- tomjen3 12y agoI disagree with 5 being a requirement for a HLL (otherwise LISP is lowlevel) and will content that C++ lacks 7 since in my mind it GC has to be non-optional and enabled by default. In addition 8 is hardly satisfied by C++, since it has neither an XML parser nor an HTTP library by default (at least last time I checked). I do admit that it has a standard library that is decently designed and much bigger than Cs.
- tormeh 12y agoBeing high-level is about more than having features - you also need to lack some features. More is not always more, if you get me. High level languages don't get segfaults. I'm not saying that dangerous behavior should be impossible, just that it should require a conscious decision where the developer is aware of the danger. In contrast C++ almost actively seeks to lead the programmer astray, hampering every effort to create good code. It's not quite the sirens singing to Odysseus - that would be PHP - but it's close.
- lispm 12y agoIf you look at ANSI Common Lisp, there is no GC support. It is not even mentioned in the standard. But the whole languages is designed to use it by default. C++ is designed to not use GC by default. Lambdas/closures in C++ are a total hack. I'd say C++ is a mid-level language with lots of emulations of high-level features. The integration of closures into C++ is an example of that. Just by integrating a high-level feature poorly into C++ does not make C++ high-level.
- cheez 12y agoHow are they a hack? They are pretty much implemented the way a programmer would write them manually.