Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Nope, 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.


Not 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

[1] Tho' processors since the Z80 have instructions to help you deal with null-terminated strings...


I 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.


> 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...


Yes, so "only" in 99.9% of the cases, including all that matter most...


So 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.


C++ 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.


You'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.


Yes, because even if they aren't that much used they do exist.

OS X drivers are written in C++, they are not wrappers over C.

http://developer.apple.com/library/mac/#documentation/device...

In Windows all the new APIs since Windows Vista are mostly COM (C++) based, including the new Userspace Driver Framework.

With Windows 8 this will increase, as Microsoft is moving to have C++ as their official systems language, by introducing WinRT as the new subsystem, and dropping support for anything besides C89.

Just because C is used a lot, you cannot say that all (even 99,9%) operating systems use it.

Actually I failed to mention the amount of operating systems that you may have running on your watch, vcr, radio, microwave, etc, which summed together are much more that the OS X, Windows, Linux base.


"..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.


I'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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: