Re: Ptr and ForeignPtr Questions

At 2001-09-20 19:32, Manuel M. T. Chakravarty wrote:
What I meant with the remark that you quote is that if you would use
foreign import foo :: Ptr Int -> IO Float
with
float foo (float *x) { return *x; }
the system will not complain, but your program may dump core.
What if the C looked like this: float foo (int *x) { return *x; } ...? -- Ashley Yakeley, Seattle WA

Ashley Yakeley
At 2001-09-20 19:32, Manuel M. T. Chakravarty wrote:
What I meant with the remark that you quote is that if you would use
foreign import foo :: Ptr Int -> IO Float
with
float foo (float *x) { return *x; }
the system will not complain, but your program may dump core.
What if the C looked like this:
float foo (int *x) { return *x; }
...?
That's ok. All I am saying is that the FFI doesn't ensure any concistency between the Haskell and the C type. Manuel
participants (2)
-
Ashley Yakeley
-
Manuel M. T. Chakravarty