4 ms·
Why can't this characterisation of "close-to-the-metal enlightenment" come from any language that surfaces your OS's SysCalls, along with an understanding of wh
by frou_dh 14y ago
Why can't this characterisation of "close-to-the-metal enlightenment" come from any language that surfaces your OS's SysCalls, along with an understanding of what compilers and assembly are?
It's possible to understand the entirety of practical computation from top to bottom without C needing to be in your toolbox. Correct me if I'm wrong.
- quesera 14y agoNope, you're right. But your "any language" almost certainly passes those syscall bindings through C to get there. Some languages are higher fidelity than others. However, C requires you to know more about how the compiler is going to turn your character string, say, or your looping construct, into assembly code. Some languages don't even have structs or pointers, or explicit memory allocation! You're laughing (I hope), but these are real things in memory, with only a thin layer of magic (layout, pointer math) in C...whereas they do exist in other languages, but are hidden -- usually pretty well, but rarely completely to the point where you are better off not knowing about them.
- gaius 14y agoNot really. Using a for loop in C requires no more understanding than using a for loop in Python. As for character strings, what you need to know in C is the "gotchas" related to running off the end, in most cases the machine would be just as happy with a Pascal-style string[1] And for pointers, I'll leave you with http://en.wikipedia.org/wiki/Tony_Hoare#Quotations http://en.wikipedia.org/wiki/Tony_Hoare#Quotations [1] Tho' processors since the Z80 have instructions to help you deal with null-terminated strings...
- frou_dh 14y agoI think Go, for example, performs syscalls directly. > However, C requires you to know more about how the compiler is going to turn your ... into assembly code. But does it really require (with emphasis)? The nature of some debugging and optimisation might push you towards that, but it's still a choice. I feel your point comes down to the use of C as a "vehicle" to learn low-level concepts. Which is fine, but someone can also just learn them directly (upfront or retroactively) and use whatever progression of languages they want.
- pjmlp 14y ago> Nope, you're right. But your "any language" almost certainly passes those syscall bindings through C to get there Only if the OS was written in C...
- batista 14y agoYes, so "only" in 99.9% of the cases, including all that matter most...
- pjmlp 14y agoSo lets see: - all the OS written before C ever existed, some still in use, even if in legacy deployments - Symbian (written in C++) - Mac OS X (is a mix of C++ and C) - Windows is moving to C++ as the default systems language - Native Oberon (Oberon) - Lilitth (Modula-2) - Spin (Modula-3) - BeOS/Haiku (Written in C++) - House (Haskell) - MarteOS (Ada) - IBM's OS/400 system (Written originally in Modula-2 and PL/MI) - Singularity (Written in C# and C++) - Lisp OS (Assembly and Lisp) - Smalltalk Machines (Assembly and Smalltalk) - Forth based OS for embedded systems So one cannot expect that an OS will be always written in C.
- quesera 14y agoC++ is C with libraries to hide some stuff and add others. Removing C++ OSes from your list, I'd say that you're down to a vanishingly small percent of deployed systems. So yes, knowing C is important. And I have never met a single person who knows any of your remaining languages who isn't at last passably familiar with C. I've never asked, but I don't think any of them would call their C knowledge unimportant or not useful.
- batista 14y agoYou're seriously mentioning Lilith, Spin, Singularity, Lisp OS, MarteOS, Smalltalk machines et al to challenge the 99.9% thing? OS X and Windows have some C++ (mostly wrappers) but otherwise are C.
- 14y ago
- bertomartin 14y ago"..possible to understand the entirety of practical computation from top to bottom without C..." - what level of understanding are you talking about? You don't need to implement data structures, for example, in order to know how to use them, but implementing them gives you deep understanding of the trade-offs you need to make, and implementing them in C specifically helps even more. You get to dig into the memory with malloc for example, you "see" and can even calculate all the memory that each struct will use up. I mean, this level of enlightenment does so much good, even if you don't use C to write production code on a daily basis.
- frou_dh 14y agoI'm just saying that it's technically possible to implement anything (including what you describe) without being forced to use C (though perhaps awkward), so it's not safe to assume that someone who doesn't know C is ignorant of the low-level. At the same time it's obviously not rational to ignore C just for the sake of it. I do like C myself and plan to continue using it. I've been looking in to OCaml recently and as someone else in the comments indicated, they seem like they'd make a good team.