9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Douglas A. Gwyn" <DAGwyn@null.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] no const?
Date: Thu, 14 Sep 2000 08:13:46 +0000	[thread overview]
Message-ID: <39BFF7BE.108DBE4F@null.net> (raw)
In-Reply-To: <20000913180633.35E20199E0@mail>

Russ Cox wrote:
> Those are the two main needs for volatile, gone, at the
> price of a little optimization, as was pointed out.
> ...
> compiler flag to make everything volatile.  This is basically
> what the Plan 9 compiler does.

Of course, implementors are free to do that.  The reason
they tell me that they don't usually is that many of their
customers demand more aggressive optimization (without the
programmer having to edit source code to get it).  If that
is not important to Plan 9 goals, then its approach is fine
and the "volatile" keyword can then in effect be a no-op.

> In the case of const, ... it certainly feels like
> such things have been added as a sacrifice to the god of
> efficiency rather than for use by mere mortals.

I use "const" frequently, and not because I expect any
additional optimization.  Rather, it documents one
important property of some parameters etc. and enables
diagnostics that routinely detect a certain class of bugs
(which would be undetectable without some programmer-
supplied indication of the intent in the source code).

> And it is a fact that const and volatile are not easily
> understood.  Try explaining to a beginning C programmer
> why "volatile Chan *c" or "Chan volatile *c" both declare
> a pointer to a volatile Chan structure rather than a
> volatile pointer to a Chan structure (which would, obviously,
> be "Chan *volatile c").

That's just a problem in understanding Dennis's contextual
design for C type declarations in general, and is no harder
to explain than anything else of a similar sort in C.



  reply	other threads:[~2000-09-14  8:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-13 18:06 Russ Cox
2000-09-14  8:13 ` Douglas A. Gwyn [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-09-13 14:39 forsyth
2000-09-13 16:44 ` Douglas A. Gwyn
2000-09-13 14:29 miller
2000-09-13 14:22 Russ Cox
2000-09-13 14:30 ` Boyd Roberts
2000-09-13 14:00 David L Rubin
2000-09-13 14:17 ` Boyd Roberts
2000-09-13 16:42   ` Douglas A. Gwyn
2000-09-13 17:03     ` Boyd Roberts
2000-09-13 17:11       ` Steve Kilbane
2000-09-13 19:33         ` Boyd Roberts
2000-09-14  8:13           ` Douglas A. Gwyn
2000-09-14 12:34             ` Boyd Roberts
2000-09-15  8:47               ` Douglas A. Gwyn
2000-09-15 11:34                 ` Boyd Roberts
2000-09-15 13:07                   ` Theo Honohan
2000-09-15 14:55                     ` Boyd Roberts
2000-09-16  8:51                       ` Matt Lawless
2000-09-18 10:47                   ` Douglas A. Gwyn
2000-09-15 20:46                 ` Steve Kilbane
2000-09-14 19:41           ` Steve Kilbane
2000-09-18 10:47             ` Douglas A. Gwyn

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=39BFF7BE.108DBE4F@null.net \
    --to=dagwyn@null.net \
    --cc=9fans@cse.psu.edu \
    /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).