Version française
Home     About     Download     Resources     Contact us    
Browse thread
Objective Caml 3.00 released
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xleroy@p...>
Subject: Re: what does "32-bit integer" mean?
> 	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