From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA10251 for caml-redist; Thu, 27 Apr 2000 15:12:40 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA19205; Thu, 27 Apr 2000 10:17:49 +0200 (MET DST) Message-ID: <20000427101749.40550@pauillac.inria.fr> Date: Thu, 27 Apr 2000 10:17:49 +0200 From: Xavier Leroy To: Max Skaller Cc: caml-list@pauillac.inria.fr Subject: Re: what does "32-bit integer" mean? References: <20000425152615.25958@pauillac.inria.fr> <39069410.FC5F5DBB@in.ot.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1 In-Reply-To: <39069410.FC5F5DBB@in.ot.com.au>; from Max Skaller on Wed, Apr 26, 2000 at 05:00:32PM +1000 Sender: weis > A comment on the documentation for the integer types. > What does '32 bit integer' mean? It means "an integer whose machine representation consists of 32 binary digits". How surprising... > What is the meaning of 'bitwise or'? It means "the logical `or' operation applied bit per bit to the machine representations of its two arguments". Unexpected, isn't it? (I think you just won the first prize for most vacuous question asked on this mailing list.) > 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?) 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? 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. 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. - Xavier Leroy