
20 Jul
2009
20 Jul
'09
2:24 a.m.
While rewriting cautious-file to use ByteStrings and FFI just now, I came across this potential problem: Why does the FFI specification define CStringLen as (Ptr CChar, Int)? As the FFI specification itself notes, Haskell 98 implementors are allowed to have a quite small range for Int (only up to 2^29-1) - so you could in principle have a very large String which cannot be represented as a CStringLen, or a very large CString which cannot be represented as a CStringLen. They would take up wads of memory, so this has probably never happened yet, but it's in principle possible, no? If so, what are the implications of this for code correctness? -- Robin