3 ms·
C++ is not going anywhere. All operating systems and almost all compilers for every other language (plus many of their runtimes) are written in it. <s>When the
by gigel82 4y ago
C++ is not going anywhere. All operating systems and almost all compilers for every other language (plus many of their runtimes) are written in it.
<s>When the heat death of the universe is upon us and all other languages have ceased to exist and re-emerged thousands of times over, C++ will still be here, driving the lower-most layers on top of hardware.</s>
- 6yyyyyy 4y ago>All operating systems C != C++
- btilly 4y agoI declare your comment to be high quality BS. First of all I never said C++ was going anywhere. I compared it to COBOL which is still estimated to be involved something on the order of 60-80% of financial transactions. C++ has a similarly bright future. But secondly, your claim is wildly overstated. C++ is a lot less fundamental and essential than you think. Operating systems: Linux and the *BSD family are written in C, with Rust making some headway. (But C++ would be over Torvalds' dead body - see http://harmful.cat-v.org/software/c++/linus http://harmful.cat-v.org/software/c++/linus for example.) OS X is written in a combination of C and Objective C. Android is written in C and Java. Windows has a lot of C++, but the kernel is straight C for reasons that Raymond Chen explains at https://learn.microsoft.com/en-us/shows/one-dev-minute/one-dev-question-raymond-chen-programming-language-windows-written-in https://learn.microsoft.com/en-us/shows/one-dev-minute/one-d.... Not only are not all operating systems written in C++, but most of the most successful ones aren't. And multiple groups, INCLUDING ones otherwise sympathetic to C++, have concluded that C++ is a terrible choice for kernels that are close to the hardware. Compilers. Well GCC is written in C. (Though Clang is C++.) So are the interpreters for Python, Ruby, Perl, and PHP. One of the backends for Go was originally C but has been ported to Go. (They maintain another C++ backend.) Julia's backend is mostly C. (A few libraries are C++.) However JavaScript and Java are both written in C++. Reality is a long, long ways from your claim that almost all compilers for every other language are written in C++. In fact straight C is a more popular choice. You didn't talk about GUI applications. But there you'd have more of a point - C++ is far more popular there. However even that it isn't a slam dunk. Rust was explicitly developed as a response to the fact that C++ makes security very hard. The idea being that it would be easier for Mozilla to port security critical modules from C++ to Rust than to secure C++. Since security is getting ever more important, it now makes sense to write in a different language first.
- kupfer 4y agoI learned something, thanks. One of Chen's arguments is, that C allows better memory control compared to C++. For example, it's easy to place the vtable in pageable memory instead of non-pageable memory. Do you know if rust has this problem too, since it also uses vtables?
- sigi64 4y agoRust uses fat-pointers to references and raw pointers to dynamically sized types (DSTs) – slices or trait objects. A fat pointer contains a pointer plus some information that makes the DST "complete" (e.g. the length, or in the case of trait objects, the additional data is a pointer to the vtable). Generally, you have, under control, where you store your fat-pointer.