caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Max Skaller <skaller@maxtal.com.au>
To: Xavier Leroy <Xavier.Leroy@inria.fr>
Cc: Max Skaller <maxs@in.ot.com.au>, caml-list@pauillac.inria.fr
Subject: Re: what does "32-bit integer" mean?
Date: Fri, 28 Apr 2000 12:07:41 +1000	[thread overview]
Message-ID: <3908F26D.98C27C2E@maxtal.com.au> (raw)
In-Reply-To: <20000427101749.40550@pauillac.inria.fr>

Xavier Leroy wrote:

> (I think you just won the first prize for most vacuous question asked on
> this mailing list.)

	Thanks :-(

> > It is _necessary_ to say something like
> >       'implements an integer with 32 bit twos complement
> > representation' for either of these statements to be meaningful,
> > that is, to establish a mapping between an array of 32 bits,
> > and an integral value.
> 
> Ah, twos complement and ones complement -- comp.lang.c 's favorite
> flame war.  (I know you love flame wars, but are you sure we should
> have this one here?

	I am not interested in wars or flame wars.
I am sure we should have this discussion, however.

> Caml integers are C integers in (slight) disguise -- by virtue of the
> Caml bytecode interpreter being written in ANSI C.  C integers are
> machine integers in (slight) disguise.  The ANSI C reference explains
> what can be assumed on integers and what is machine-dependent.  Yes,
> bitwise operations expose the difference between twos complement and
> ones complement.  So what?

	This would be a flaw in the ocaml language specification.
 
> At any rate, no ones complement computer have been produced in the last
> 20 years, so it should be safe to assume twos complement if you need
> to make that assumption.

	I'm not interested in 'should be safe' as much as
specified language semantics. In this case, you are 
refering to the 'C specification', but this is not done
in the manual. You also do not say WHICH C specification,
C90 or C9X. The semantics I refer to are tightened up a bit
in C9X.
 
> This reminds me of a nice compiler book from the late 60s, whose title
> is something like "Compilation for digital computers".  Presumably, in
> these days, one had to specify that one's computer was digital, not
> analog.  Now we don't bother.

	I am a member of the C committee.
The issues here are important and non-trivial.
I write algorithms that depend on it :-) 
I point them out only as a service to the ocaml community
(myself included of course :-)

In particular, since ocaml does not provide any unsigned integers,
it is exposed to the mal-specified signed operations of the C
compiler. I do NOT like this. I would rather that the
ocaml team provide a mathematical definition, and MAKE
the implementation work that way on all target machines
independently of what C does.

	This is the course taken by Python.

	I also do not use the bytecode interpreter.
I'm interested in what the optimising compiler does.

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net




  parent reply	other threads:[~2000-04-28 10:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-25 13:26 Objective Caml 3.00 released Xavier Leroy
2000-04-25 19:08 ` John Prevost
2000-04-26  7:00 ` Max Skaller
2000-04-27  8:17   ` what does "32-bit integer" mean? Xavier Leroy
2000-04-27 15:41     ` Paul A. Steckler
2000-04-28  2:07     ` John Max Skaller [this message]
2000-04-28  8:35       ` Xavier Leroy
2000-04-28 23:24         ` John Max Skaller
2000-04-26  9:55 ` Objective Caml 3.00 released Andreas Rossberg
2000-04-26 20:02 ` LablTk in Objective Caml 3.00 T. Kurt Bond
2000-04-28  0:22   ` Jacques Garrigue
2000-04-28  2:12     ` T. Kurt Bond
2000-04-26 21:35 ` Help: anyone knows what this error message means Friedman Roy
2000-04-27 13:39   ` Frank Atanassow
2000-04-27 17:01 ` Objective Caml 3.00 released Julian Assange

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=3908F26D.98C27C2E@maxtal.com.au \
    --to=skaller@maxtal.com.au \
    --cc=Xavier.Leroy@inria.fr \
    --cc=caml-list@pauillac.inria.fr \
    --cc=maxs@in.ot.com.au \
    /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).