
9 Nov
2003
9 Nov
'03
2:27 a.m.
sön 2003-11-09 klockan 03.32 skrev Ben Escoto:
Hi, I'm trying to learn about Haskell's FFI (running 6.0.1 on linux) and see the following weird behavior with ghci:
Prelude> :module Data.Word Foreign.Storable Foreign.Ptr Prelude Foreign.Ptr Foreign.Storable Data.Word> sizeOf nullPtr 4 Prelude Foreign.Ptr Foreign.Storable Data.Word> sizeOf (nullPtr :: Ptr Word64) 4
Shouldn't "sizeOf nullPtr" return an error? And sizeOf a Ptr Word64 should be 8 I think.
The size of a pointer is not the same as the size of what it points at. On ia32 (x86) architectures, the size of a pointer is always 4 bytes (32 bits). Regards, Martin