5 ms·
>> Learning about operating systems would be much harder without C. The operating systems that we use are mostly written in C, the C standard library is tightly
by anta40 10y ago
>> Learning about operating systems would be much harder without C. The operating systems that we use are mostly written in C, the C standard library is tightly coupled to the syscall interface, and most resources dealing with operating systems concepts assume knowledge of C.
I wonder what if Kernighan, Ritchie et all decided to write UNIX in Pascal, not in C.
Hmmm.... :D
- unwind 10y agoI don't think that was ever very likely, it kind of seems like Mr Kernighan didn't like Pascal: https://www.lysator.liu.se/c/bwk-on-pascal.html https://www.lysator.liu.se/c/bwk-on-pascal.html. I'm not at all clear about the detailed timeline, but this link is a pretty good answer to that thought. :)
- pjmlp 10y agoOn that famous rant he selectively chosed to ignore all Pascal dialects that offered the features he complained about, while at the same time ignoring that outside UNIX there weren't full C compilers available, rather dialects.
- kabdib 10y agoPascal. Dialects. That was the problem. Pascal was designed as a teaching language, then people realized it sucked as a language in the real world, so they extended it. There were quite a few Pascal variants in the late 70s / early 80s, and none of the useful code you could write in them was portable. C had all the features you needed in an OS-level language, without resorting to variants (the X86 near/far bullshit notwithstanding, you used macros and typedefs to shift that stuff around). So Pascal more or less died in the industry. I was at Apple when they converted from a Pascal shop to a C shop. There wasn't any big managerial push, just individual engineers or small teams realizing that the nightmare was over and they could use a language that sucked a lot less.
- pjmlp 10y agoHowever I remember the chore that was writing portable C code when you could not rely what compiler was available, specially outside UNIX. For those of us in MS-DOS and Windows, only Turbo Pascal mattered, to the point it was more relevant to be TP compatible than supporting ISO Extended Pascal, which also sorted out most of the complaints. Complainants which were nonexistent in Modula-2 anyway. The industry choose the easy path, now we all pay with our mainstream OSes built on top of a quicksand language.
- Roboprog 10y agoIt's a shame Modula wasn't available until the early 80s (as far as I know), but unfortunately, you are right. C is vastly preferable to writing assembler on multiple platforms, though. The real tragedy is IT Managment(TM), which insisted on C++, and after that inevitably failed (for most things outside of video games), insisted on Java due to all the core dumping craziness. Can't find the original source doc, but here goes: https://blog.acolyer.org/2016/09/07/the-emperors-old-clothes/ https://blog.acolyer.org/2016/09/07/the-emperors-old-clothes... At least K&R took quicksort(), even if they didn't take the array subscript bounds checking part (etc) to heart.
- Roboprog 10y agoOne other C inspired tragedy: WHY, OH WHY, did they insist on putting identifier names AFTER (most of) the type information??? Algol had it right, why screw it up? I guess it doesn't matter if your (optional) type is word^H^H^H^H int, but this has descended into chaos in Java land.
- MaysonL 10y agoOr if Wirth had had the marketing nous to call Modula Pascal+ and Oberon Pascal++.
- pdw 10y agoThere was TUNIS in the early 80s, an operating system binary compatible with V7 Unix and implemented in a Pascal-like language. I've been meaning to find more information on it, but there's almost nothing online. It might be the only Unix clone that isn't implemented in C/C++.
- anta40 10y agoThat's why I think UNIX was a very good marketing vehicle for C. In the 1970s, universities began to adopt C. Since UNIX was written in C, academists/students began to learn C, and that was how the rise of C, now known as "the lingua franca of computing", started. Personally, one valid reason for me to learn C today is to understand/hack stuffs written in it. A fine example is the Linux kernel. I still don't get the "C is close to machine" mantra. If you want to understand the machine, why don't just learn assembly instead? :D
- joezydeco 10y agoIn my experience, assembly makes you do a lot of busywork over and over to achieve certain constructs. Loops and function calls come to mind immediately. They're not hard things to do in assembly, but you'll need to write those every single time you need one. So then you start making macros to handle this for you. By that point the conceptual leap to C isn't very far.
- pjmlp 10y agoThey would have re-invented, Burroughs OSes from 1960's and made computing a safer world. :)