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
This archive was generated by hypermail 2b29 : Fri Apr 28 2000 - 12:11:35 MET DST