Re: Why C for operating systems




"Pascal J. Bourguignon" <pjb@xxxxxxxxxxxxxxxxx> wrote in message
news:878wdgiedq.fsf@xxxxxxxxxxxxxxxx
"Bill Cunningham" <nospam@xxxxxxxxxxxxx> writes:

One reason why I am so attracted to C and not just markup languages
scripts and java is that C is for designing OS's. What exactly is it
about
C that makes it good to write operating systems?

Nothing. Well, historical accident.
Well, apart from the fact that it was developed to write unix.

First, you should keep in mind that operating systems have been
written in a lot of other programming languages, either assembler or
high level programming languages. C is not the best system
programming language, far from it.


<snip>

actually I disagree, and infact will hold the position that most of what was
written here is actually a big load of crap...

one thing that C-family languages have demonstrated themselves as being
really good at, is shaving away bytes and clock cycles "here and there" much
better than most other programming languages (apart from assembler).

hence, one "could" use a higher level language, and eat through a few more
bytes of memory here and there ("well, who cares if this integer always uses
32 bits when it could just as easily fit in 8?..."), and a few more clock
cycles here and there ("no one will notice this here indirect jump
instruction?"), ...

it may seem all fine and well, after all, modern computers ARE way the hell
faster and have have craploads more memory.


however, there is another property also worth noting:
these small costs have a way of adding up very quickly and coming to bite
one from behind later on, and so the choice at this later point may become
obvious:
a system which runs clean and smooth and in a small memory footprint;
or, a system which wastes lots of memory and performs like crap.


granted, yes, there are a few things C does not do well at.

this is why, even those of us who write most of their in C, may at times
have reason to use other languages (C++, ASM, or even HLL's / interpreters).

but, C holds its position for good reason, and as I see it, it is not simply
some accident, it all happened this way because it happened to be very good
at what it does well (and its main competitors could not perform similarly
in the same window).


and, granted, yes, a person can write total crap code, even in C...
however, most of its costs are more due to the code written in it, rather
than of the language itself...


or, one could even go as far as to assert that we live in a world where all
is well ordered and where everything happens for a reason (even those things
which may seem, upfront, to be terrible, may have been, at the end of the
day, the best possible course of events...).



.



Relevant Pages

  • Re: VB to C#
    ... there is in programming languages no ... We could not design and redesign the memory usage ... I'm very glad that the feature is missing in C#, ... worse than the cost to readability of using named indexers would have ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Public variables
    ... My own best practise by the way is to avoid the Dim keyword at class level wich is confusing about this. ... In old programming languages you could in fact only declare your variables fixed in your program in a kind of static way. ... Therefore you see in some older languages stil used for this Static, in fact a little bit outdated, as all data is relocatable stored in the memory your computer. ...
    (microsoft.public.dotnet.languages.vb)
  • Objects, Type, and OOP [Was: What is an object?]
    ... An "object" in C is basically a hunk of memory that can hold ... SIGPLAN-SIGACT symposium on Principles of programming languages" ... of classes "class objects". ... I believe there has been some influence of the OOP term ...
    (comp.lang.c)
  • Re: Which is better, pass, or not pass by reference?
    ... > or passing by reference. ... > doubling the memory usage for this data... ... Am I right that passing by reference means ... programming languages go farthest in this respect, ...
    (comp.lang.php)
  • Computer Philosophy
    ... Business, transportation, industry, libraries, schools, ... I have a Lobo computer running CP/M Plus on 2 hard drives. ... powerful programming languages to play with. ... years before hardware and operating systems can get together to ...
    (comp.os.cpm)