6 ms·
"C/C++ have managed to be the foundation of every piece of technology a consumer or a computer professional will ever touch in their daily life" That has nothi
by betterunix 13y ago
"C/C++ have managed to be the foundation of every piece of technology a consumer or a computer professional will ever touch in their daily life"
That has nothing to do with the technical merits of either language, and everything to do with a small number of early programmers' choice to use those languages -- which left us with a massive legacy codebase and an incentive to keep teaching people those languages. To put it another way, Unix is the reason C is popular and Windows is the reason C++ is popular. People who write software for Unix and Windows have compelling reasons to use C and C++, since every program ultimately needs to interact with the OS once in a while.
Every time someone brings up the crippling technical deficiencies of C and C++, someone responds with a point about C/C++ being popular. All that says is that technical merits are not necessarily a determining factor in language choice.
- CCs 13y agoI think the actual argument was "C/C++ is not great, but others are worse". :) Pretty much all languages have handy OS API calls, usually a lot more portable than C/C++ - so that's not a compelling reason. Yet somehow a lot of new code is still written in C/C++: Redis, Memcached, Nginx, MongoDB, Android, Chrome etc
- betterunix 13y agoI am speaking from experience here. The only language I have used where this does not apply is F#, and only if you count .NET support. I love CL, I never want to go back to C or C++, but the most annoying aspect is the lack of good system call support. Sure SBCL has a posix compatibility layer, but anything beyond basic system calls becomes a drag. In the worst case you wind up having to write a C function to wrap a system call just to expose an easier-to-use interface for the FFI. It is a complete mess, and it becomes a maintenance nightmare.
- scythe 13y agoWell, there is also the difficulty that there has not been, save Ada, a serious and concerted effort to replace C and C++ for so many of the things that they are used for. Except for Ada, no other modern language is suitable for writing things like kernels, drivers, emulators, etc; except for Ada, basically all modern languages are dependent on garbage collection. So if you want to complain about C, remember that the only serious alternative is and has been Ada, and ask yourself why you're not using Ada, why operating systems and window managers, mupen64plus and Wayland, et cetera don't use Ada, and the truth is: people like C more than Ada. Ada is the anti-C++. It's the answer to every criticism. It's also basically unheard of outside of situations where people really, really need safety cf. airline industry. In fact most of the people who complain about C++ would never even consider Ada. The author of the article seems to be unaware it even exists, which says a lot. The takeaway is that safety is overrated, consistency is overrated, reliability is overrated, because if we really cared about these things... we'd use Ada. And we don't, because "Ada is annoying!".
- graue 13y agoRust[1] is aimed squarely at this use case. The GC and runtime are optional. A toy kernel[2] and Linux kernel module[3] have already been written in it. The language is young and still unstable, but it's being designed by veteran C++ programmers with the goal of using it for a safer, faster, more maintainable successor[4] to the browser engine in Firefox. Worth checking out! [1] http://www.rust-lang.org/ http://www.rust-lang.org/ [2] https://github.com/charliesome/rustboot https://github.com/charliesome/rustboot [3] http://thechangelog.com/rust-ko-a-minimal-linux-kernel-module-for-rust/ http://thechangelog.com/rust-ko-a-minimal-linux-kernel-modul... [4] https://github.com/mozilla/servo https://github.com/mozilla/servo
- haimez 13y agoIt's also difficult to find a compiler, programming tutorials, or a community for. I think there are a LOT of reasons programming languages are chosen by developers and that most of those reasons aren't all that rational or well informed.
- BruceIV 13y agoGood compiler support, a wealth of documentation, an active community, and a number of well-maintained libraries are all rational and informed reasons to choose a programming language. Network effects matter.
- DonPellegrino 13y agoThere is another attempt at it. That language has been in development for a few years and is almost ready. Rust combines the best features of C and functional programming and through a very clever pointer system manages to eliminate race conditions, null pointers and dangling pointers at compile time. It has a powerful type system and smart type inference. It's possible to have some memory be garbage collected, but by default it isn't so it can be used for tasks that prohibit garbage collection. The compiler ensures that freed memory will never be accessed. It's built for modern parallel hardware and offers tons of concurrency features, like lightweight tasks, actors, async, etc. Its structs are compatible with C and Rust can integrate seamlessly with C code and librairies. It compiles to native using LLVM. It's backed by a major non-profit, Mozilla. It's a fantastic project and it seems to have all the right cards to be the perfect alternative to C++. Check it out. My only disappointment (and the reason why I'm not using it seriously at the moment) is that because the language is still in development, it changes extremely fast and 80% of the documentation online is wrong and won't compile. Even the official documentation contains a lot of outdated syntax. Hopefully that will change once the language reaches version 1.0, in the next 3-6 months.
- pjmlp 13y ago> Unix is the reason C is popular and Windows is the reason C++ is popular. I never understood why people say C++ is popular because of Windows. C++ was already popular before Windows mattered. My first C++ applications were targeted at MS-DOS, back in the days most PC compatibles were still sold with 1 MB of RAM and almost no one has Windows installed. Before Java was created, many of us were already doing C++ with CORBA in commercial UNIX systems. Microsoft compilers only mattered to us around the time Windows NT started to enter the enterprise and the 32 bit version of Visual C++ was introduced. C++ got popular due to its almost 100% C compatibility and as with C, UNIX also contributed to its spread in the enterprise, not Windows.