[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: an alternate BOGUS-FIXNUMS proposal



> From: Jeff Dalton <jeff%aiva.edinburgh.ac.uk@NSS.Cs.Ucl.AC.UK>
> Date: Wed, 13 Jul 88 20:16:02 bst
> 
> Perhaps we should look at
> what languages like C say about "short", "int", and "long".  (Very
> little is promised, as I recall.)
> 
> I'm not sure just what aspects of C and Pascal programs you have in
> mind.  There are certainly many programs that use "int" or "long", and
> those are analogous to FIXNUM, not to explicit ranges of integers or
> numbers of bits.

Yes, people do declare things as "int" in C code without giving a
great deal of thought to how big an "int" really is.  But in my mind,
not being guaranteed anything about integer sizes in C (and not being
able to define subrange types as you can in Pascal) is a misfeature.
I don't think its presence in C is a valid justification for including
it in Lisp.

An example of a portable C program that I'm familiar with is the MG
text editor.  It runs on 8 or 9 different configurations (3 of which I
have personally hacked on), including some machines where ints are 16
bits and longs 32, some where both ints and longs are both 32 bits,
and I believe one where ints are 32 and longs are 64.  We define
things like the integer type to use for indexing into a region (that
you really want to be 32 bits, but that might be either int or long)
with #typedef's in a system-specific include file.  Likewise the size
of integer that represents a keystroke (12 bits) might need to be
defined as either a short or int.  We've found that portability
problems are almost invariably due to code that violates the data
abstraction by doing things like declaring a variable that is used to
index into a region as "int" instead of "RSIZE", or assuming that int
and long are the same size. 

-Sandra
-------