9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Richard Miller <9fans@hamnavoe.com>
To: 9fans@9fans.net
Subject: Re: [9fans] caveat... optimizer? the `zero and forget' thread on HN
Date: Tue, 30 Oct 2012 10:26:52 +0000	[thread overview]
Message-ID: <54081475312e69df29032eaaa29127dd@hamnavoe.com> (raw)
In-Reply-To: <20121029232652.5160BB827@mail.bitblocks.com>

> Best way to save developer time is to program in a HLL and not
> worry about bit fiddling. C is not a HLL.

C was created as a language to do bit fiddling in - a tool for writing
assembly language a bit more productively than doing it by hand.  The
original Unix C compiler was a tool for writing PDP11 assembly
language.  Later when the prospect of Unix on other architectures
began to emerge, the 7th edition Unix "portable C compiler" was a
family of tools for writing assembly language on different machines.

C was designed by and used by systems programmers who were intimately
familiar with their machine's instruction set, and the code generation
was so simple and straightforward that to such programmers it would be
obvious what instructions would correspond to a given bit of C. The
low-level directness of C made it easy to write efficient code, so
there was no need for the compiler itself to try to do clever
"optimisations".

Such a language was and still is just what is needed for writing
device drivers and the lowest layers of OS kernels where things like
memory layout and instruction ordering are important.  It's not such a
good match for writing the more abstract upper layers of an OS, and
even less so for applications programming.  I think it's unfortunate
that C ended up being so widely (mis)used for applications
programming, and by applications programmers who have never learned
assembly language, causing pressure for compilers to be obfuscated
with semantics-perverting "optimisations" and, in an attempt to
compensate for this, the language to be defaced with "features" like
volatile and __attribute__ and whatnot.

I think inferno got it about right: write the kernel in C, and
the applications in a high level language (limbo).




  parent reply	other threads:[~2012-10-30 10:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-29  9:45 dexen deVries
2012-10-29 10:12 ` tlaronde
2012-10-29 13:43   ` erik quanstrom
2012-10-29 13:35 ` erik quanstrom
2012-10-29 22:35   ` Bakul Shah
2012-10-29 22:47     ` Charles Forsyth
2012-10-29 23:05       ` Bakul Shah
2012-10-29 23:07         ` erik quanstrom
2012-10-29 23:15           ` David Leimbach
2012-10-29 23:20             ` erik quanstrom
2012-10-29 23:53               ` andrey mirtchovski
2012-10-29 23:59                 ` Kurt H Maier
2012-10-29 23:10     ` erik quanstrom
2012-10-29 23:26       ` Bakul Shah
2012-10-29 23:31         ` Bakul Shah
2012-10-29 23:36         ` erik quanstrom
2012-10-29 23:58           ` Charles Forsyth
2012-10-30  0:52             ` Bakul Shah
2012-10-30  1:01               ` erik quanstrom
2012-10-30  7:55             ` tlaronde
2012-10-30  0:35           ` Bakul Shah
2012-10-30  1:10             ` erik quanstrom
2012-10-30  3:06               ` Bakul Shah
2012-10-30  3:16                 ` Corey Thomasson
2012-10-30 13:08                   ` erik quanstrom
2012-10-30 15:15                     ` arnold
2012-10-30  1:46             ` cinap_lenrek
2012-10-30  1:21         ` Kurt H Maier
2012-10-30  8:07         ` tlaronde
2012-10-30 10:26         ` Richard Miller [this message]
2012-10-30 10:39           ` dexen deVries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54081475312e69df29032eaaa29127dd@hamnavoe.com \
    --to=9fans@hamnavoe.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).