Alastair David Reid <reid@cs.utah.edu> wrote,
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
To be honest, by now I am prepared to leave the status quo as it is, which, as you say, basically forces any sensible implementation to make `Int' as big as pointers. Cheers, Manuel