4 ms·
Despite what some people religiously think about programming languages, imo C was so successful because it is practical. Yes it is unsafe and you can do absurd
by randomNumber7 2y ago
Despite what some people religiously think about programming languages, imo C was so successful because it is practical.
Yes it is unsafe and you can do absurd things.
But it also doesn't get in the way of just doing what you want to do.
- bamboozled 2y agoSounds a bit like perl but at a lower level ?
- high_priest 2y agoSounds a bit like JavaScript, but at a tower level?
- TingPing 2y agoI wouldn’t compare them, C is very simple.
- codr7 2y agoYes, but there are similarities, it has the same hacker mind set imo.
- ThinkBeat 2y agoYou can certainly do entirely absurd things in Perl. But it is a lot easier / safer work with. You get / can get a wealth of information when you the wrong thing in Perl. With C segmentation fault is not always easy to pinpoint. However the tooling for C, with sone if the IDEs out there you can set breakpoints/ walk through the code in a debugger, spot more errors during compile time. There is a debugger included with Perk but after trying to use it a few times I have given up on it. Give me C and Visual Studio when I need debugging. On the positive side, shooting yourself in the foot with C is a common occurrence. I have never had a segmentation fault in Perl. Nor have I had any problems managing the memory, the garbage collector appears to work well. (at least for my needs)
- TinkersW 2y agoEh Segfaults are like the easiest error to debug, they almost always tell you exactly where the problem is.
- relistan 2y agoExcept when they don’t. I’m debugging something right now that runs fine under debugging conditions and crashes with a segfault in real life. It’s not randomized memory (messed with that), it’s likely some race where the timing is changed by the debugger.
- bamboozled 2y agoruns fine under debugging conditions and crashes with a segfault in real life There's your clue right there...
- relistan 2y agoYes. Did you read what I wrote?
- randomNumber7 2y agoAdressSanitizer is an absolute gamechanger and should amost always spare you the effort of the nightmare debugging of undefined behaviour.
- ycuser2 2y agoI don't think C was successful. It still is! What other language from the 70s is still under the top 5 languages? https://www.tiobe.com/tiobe-index/ https://www.tiobe.com/tiobe-index/
- Horffupolde 2y agoSQL, Lisp.
- dharmab 2y agoSQL absolutely. Lisp is not anywhere near top 5, though. https://survey.stackoverflow.co/2024/technology#most-popular-technologies-language https://survey.stackoverflow.co/2024/technology#most-popular...
- zerr 2y agoNo, it's because of Unix and AT&T monopoly.
- relaxing 2y agoHow was AT&T’s monopoly a driver? It’s not like they forced anyone to use UNIX.
- linguae 2y agoIronically, AT&T's monopoly actually helped the adoption of Unix, but not in an exploitative way. In 1956, AT&T was subject to a consent decree by the US government, where AT&T was allowed to maintain its phone monopoly but was not allowed to expand its market to other sectors. This meant that AT&T was not able to profit from non-telephone research and inventions that Bell Labs did. During Unix's early days, AT&T was still under this decree, meaning that it would not sell Unix like how competitors sold their operating systems. However, AT&T licensed Unix, including its source code, to universities for a nominal fee that covered the cost of media and distribution. UC Berkeley was one of the universities that purchased a Unix licenses, and researchers there started making additions to AT&T Unix which were distributed under the name Berkeley Software Distribution (this is where BSD came from). There is also a famous book known as The Lions' Book (https://en.wikipedia.org/wiki/A_Commentary_on_the_UNIX_Operating_System https://en.wikipedia.org/wiki/A_Commentary_on_the_UNIX_Opera...) that those with access to a Unix license could read to study Unix. Bootleg copies of this book were widely circulated. The fact that university students, researchers, and professors could get access to an operating system (source code included) helped fuel the adoption of Unix, and by extension C. When the Bell System was broken up in 1984, AT&T still retained Bell Labs and Unix. The breakup of the Bell System also meant that AT&T was no longer subject to the 1956 consent decree, and thus AT&T started marketing and selling Unix as a commercial product. Licensing fees skyrocketed, which led to an effort by BSD developers to replace AT&T code with open-source code, culminating with 4.3BSD Net/2, which is the ancestor of modern BSDs (FreeBSD, NetBSD, OpenBSD). The mid-1980s also saw the Minix and GNU projects. Finally, a certain undergraduate student named Linus Torvalds started work on his kernel in the early 1990s when he was frustrated with how Minix did not take full advantage of his Intel 386 hardware. Had AT&T never been subject to the 1956 consent decree, it's likely that Unix might not have been widely adopted since AT&T probably wouldn't have granted generous licensing terms to universities.
- anta40 2y agoIf you want to do microcontroller/embedded, I think C it still the overall best choice, supported by vendors. Rust and Ada are probably slowly catching up.