|
|
Darren New <dne### [at] sanrrcom> wrote:
> > Of course in C. And "undefined behavior" can also mean "works as desired
> > in this platform".
> That's what I'm distinguishing. That's why I say C, as such, isn't very good
> for that sort of thing. You can do it, but only because you look at what
> your particular compiler generated for some piece of otherwise undefined
> code, and say "yes, that's what I'd like."
There aren't many programming languages out there which would allow the
same kind of "controlled compiler abuse" as C, which is precisely why it's
so popular to write kernels and device drivers.
Of course not all kernels in existence have been written in C (or asm),
but right now I can't say what other languages have been used to write
kernels.
> > Most DOS demos written in C used raw pointers (eg. to the VGA memory
> > buffer). They worked just fine on that platform.
> Maybe I'm more of a theoreticist, but "it works for me" isn't how I like to
> write kernels. ;-)
Sometimes you just have to. No programming language can account for every
single feature a kernel needs. Sometimes you just *must* bypass the standard
language and poke the hardware directly.
The only other alternative would be to write the kernel in assembly, which
would be enormously less portable and less manageable than C.
--
- Warp
Post a reply to this message
|
|