RE: ANN: H98 FFI Addendum 1.0, Release Candidate 13
"Simon Marlow" <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.ffi |
|---|---|
| Message-ID | <3429668D0E777A499EE74A7952C382D10113C13A@EUR-MSG-01.europe.corp.microsoft.com> |
> I have put RC 14 at > > http://www.cse.unsw.edu.au/~chak/haskell/ffi/ > > including all the feedback on RC13. Please especially have > a look at Section 6.3 (Section "CString"), where some of the > wording changed. The spec is silent on how exactly a Haskell Char is translated to a CWchar, and there aren't any conversion functions ala castCharToCCHar / castCCharToChar. So presumably the expected behaviour is that the implementation does its best to translate between Unicode Char and whatever encoding the prevailing C library is using for wchar. Any sensible implementation will be using Unicode for wchar too, so the translation will be a simple no-op, but the C standard doesn't specify this. Older systems will probably have a locale-dependent encoding for wchar. The GNU C library has a slight bug in this regard, too (see previous discussion). I expect that when we implement the CWString operations for GHC we won't bother with any locale-dependent translations, so the implementation will only work on "sensible" systems. There is a fair bit that is non-obvious here, so I feel the spec ought to say something. Cheers, Simon