caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <xleroy@pauillac.inria.fr>
To: John Max Skaller <skaller@maxtal.com.au>
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 10:35:09 +0200	[thread overview]
Message-ID: <20000428103509.02540@pauillac.inria.fr> (raw)
In-Reply-To: <3908F26D.98C27C2E@maxtal.com.au>; from John Max Skaller on Fri, Apr 28, 2000 at 12:07:41PM +1000

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

My apologies for the sarcasm; I know I shouldn't have done it, but I just
couldn't resist :-)

> 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.

We could easily specify Caml's integers as twos complement, with
division that rounds towards zero, signed modulus, etc, etc --- all the
guarantees that C doesn't give us ---, then check those properties
during configuration and refuse to compile OCaml on machines that do
not meet those properties.  Given that all modern machines meet them,
that would not be a limitation in practice.

The other option (emulate twos complement / signed modulus / etc) on
machines that do not provide them naturally is too much
work, and just pointless (since such machines no longer exist).

> 	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 :-)

Thanks.  But as a member of the C committee, you could make all of us
(not just Caml users, but C programmers as well) a HUGE service
by pushing forward a C standard that fully specifies signed integer
arithmetic, e.g. like Java does.  (While you're at it, please standardize
IEEE floats as well.)

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

The situation is much better on the native compiler front: since we
know exactly which processors are supported, we can actually guarantee
twos complement, division that rounds towards zero, signed modulus,
etc, etc, just because all the supported processors implement those
properties.

The limiting factor is the bytecode interpreter, at least as long as
we want it to work on any system with an ANSI-compliant C compiler.

- Xavier Leroy




  reply	other threads:[~2000-04-28 10:19 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
2000-04-28  8:35       ` Xavier Leroy [this message]
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=20000428103509.02540@pauillac.inria.fr \
    --to=xleroy@pauillac.inria.fr \
    --cc=caml-list@pauillac.inria.fr \
    --cc=maxs@in.ot.com.au \
    --cc=skaller@maxtal.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).