
22 Jan
2021
22 Jan
'21
8:31 p.m.
On Fri, Jan 22, 2021 at 08:45:54AM -0500, Andrew Martin wrote:
x <- malloc ... memcpy ... copy a nul-terminated string into x let len = cstringLength x free x
Isn't this broadly true for general uses of CString? Which is why we have `withCString`: https://hackage.haskell.org/package/base-4.14.1.0/docs/Foreign-C-String.html... Is there any particularly different about the proposed `cstringLength`? Are you suggesting that it should have an "IO Int" result type to force sequencing? Is this warranted? Shouldn't users of CString (Ptr CChar) be already aware of the liveness issue in general. -- Viktor.