On 09/07/2010 18:46, John Meacham wrote:
On Fri, Jul 09, 2010 at 12:39:38PM +0100, Simon Marlow wrote:
On 08/07/2010 22:46, John Meacham wrote:
Ack, I just noticed that IntPtr,IntMax, and WordPtr and WordMax were
left out of the report. These are fairly vital for writing portable FFI
code.
Make a proposal to get them into Haskell 2011, I don't imagine it would
be controversial.
That's the thing, They were already accepted as part of H'2010. At least
according to the site:
http://hackage.haskell.org/trac/haskell-prime/wiki/ForeignFunctionInterface
Ok, this is probably an oversight on my part, so sorry about that. I
can treat it as errata and fix the report.
However I'm a bit confused. Currently we have IntPtr and WordPtr
exported by Foreign.Ptr in base, but we don't have IntMax and WordMax
anywhere that I can see, and I don't recall any discussion about where
they should be defined, or what they should be defined to.
We do have CIntPtr, CIntMax, CWordPtr and CWordMax all exported by
Foreign.C.Types, and they would seem to fulfill the requirements for
portability with C99, except that we don't have a way to convert between
CIntPtr/CWordPtr and Ptr/FunPtr. So wouldn't the right thing to do be
to add those conversions? If we added IntPtr to Foreign.Ptr instead,
that still doesn't let you write portable FFI bindings because there's
no requirement that IntPtr is equivalent to intptr_t.
Cheers,
Simon
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell