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] go forth and ulong no more!
Date: Thu, 22 Nov 2012 11:00:47 +0000	[thread overview]
Message-ID: <3405876c84b4b238ab22a9d1200a77a2@hamnavoe.com> (raw)
In-Reply-To: <52369c6626d4245fb56cebedb438801a@kw.quanstro.net>

> .B char
> can generally be assumed to be a signed value.

What does "generally" mean here?  Is it safe to assume or not?

> There are no signed variants of these as they
> are not useful where size-specific types are appropriate.

"Not useful" seems an arbitrary judgment.  There are certainly
cases where widths are "fixed by hardware" (eg device registers)
but values are semantically signed (eg address increment/decrement
value in a DMA controller).

> .B Usize
> represents the type returned by the C
> .B sizeof
> operator.  It is typically the same width as a virtual address.

What does "typically" mean here?  Is it or isn't it?

> In order to ease the transition to 64-bits, the AMD64 compiler
> currently uses a 32-bit
> .BR usize .

Oh, so it isn't.

> .B uintptr
> as a physical address may be the same size, larger (PAE), or smaller than a> virtual address.

Should that be uintmem?

> .B Uintmem
> also stores the sizes of things that
> .B uintmem
> might address.

Strange inconsistency - why then doesn't uintptr store the sizes of
things that uintptr might address?

> .B schar
> is used when porting to other systems where it may matter.  It should not generally be used.

Is this saying it doesn't matter in Plan 9 whether chars are signed or not?
What is the exception to the "generally"?

My opinion:

A type system is useful if and only if it helps you write code which will be
correct in every environment in which it might run.  Guidelines for usage
which will be "generally" or "typically" correct just encourage bad habits.
(Of which I am as guilty as anyone.)

OTOH, it's not worth making special provision for physical memory addresses.
I think that any code which is dealing with those is not likely to be
portable to another architecture for many other reasons.  I can't envision
a single mmu.c being applicable to both 386 and amd64 ...




  reply	other threads:[~2012-11-22 11:00 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20 21:49 erik quanstrom
2012-11-22  0:18 ` Federico G. Benavento
2012-11-22  1:21   ` erik quanstrom
2012-11-22  1:35     ` Bruce Ellis
2012-11-22  2:08       ` Dan Cross
2012-11-22  2:15         ` Bruce Ellis
2012-11-22  2:33           ` Charles Forsyth
2012-11-22  2:35             ` Charles Forsyth
2012-11-22  3:44               ` Bruce Ellis
2012-11-22  8:56                 ` Charles Forsyth
2012-11-22  9:02                 ` Charles Forsyth
2012-11-22 10:21                   ` erik quanstrom
2012-11-22 11:00                     ` Richard Miller [this message]
2012-11-22 11:11                       ` Charles Forsyth
2012-11-22 11:13                         ` Charles Forsyth
2012-11-22 11:32                         ` Richard Miller
2012-11-22 11:38                           ` Charles Forsyth
2012-11-22 11:49                       ` erik quanstrom
2012-11-22 13:26                         ` Richard Miller
2012-11-22 14:05                           ` Charles Forsyth
2012-11-22 14:53                           ` erik quanstrom
2012-11-22 11:50                       ` erik quanstrom
2012-11-22 11:10                   ` Richard Miller
2012-11-22 11:13                     ` Charles Forsyth
2012-11-22 11:32                     ` Charles Forsyth
2012-11-22 11:33                       ` Charles Forsyth
2012-11-22 10:31                 ` Charles Forsyth
2012-11-22 12:39                   ` Anthony Martin
2012-11-22 12:48                     ` Charles Forsyth
2012-11-22 12:50                       ` Charles Forsyth
2012-11-22 12:54                       ` Anthony Martin
2012-11-22 13:08                         ` Charles Forsyth
2012-11-22  9:59       ` Charles Forsyth
2012-11-22  9:38     ` Charles Forsyth
2012-11-22  9:40       ` Charles Forsyth
2012-11-22 18:18       ` Federico G. Benavento
2012-11-22 11:36 Richard Miller
2012-11-22 11:45 ` Charles Forsyth
2012-11-22 11:54 ` Steve Simon
2012-11-22 11:59   ` Charles Forsyth

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=3405876c84b4b238ab22a9d1200a77a2@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).