FFI Report, CVS Id 1.11

Alastair David Reid reid at cs.utah.edu
Fri Aug 24 14:20:41 EDT 2001


Marcin:
> | > PtrDiff 

SimonPJ:
> I must say that I rather agree with Marcin here.  Let's just use Int
> (but not Int32!). On machines with big address spaces, Ints will be
> big.  Keep it simple. Oh, and efficient!

For all the reasons I've used in the past of avoiding future problems
(especially those associated with Int), I disagree.  But I didn't seem
to make much headway last time so let me just make this suggestion:

  Let's add some asserts to the affected code so that we'll get warnings
  when we try to compile the code on a system that breaks these assumptions.
  Something like this:

  #if SIZEOF_INT != SIZEOF_PTR
  #error "Pointer difference operation could overflow - please fix"
  #endif

-- 
Alastair Reid        reid at cs.utah.edu        http://www.cs.utah.edu/~reid/




More information about the FFI mailing list