> On Fri, Nov 14, 2003 at 01:57:41PM +1100, Manuel M T > Chakravarty wrote: > > These marshalling routines convert Haskell's Unicode > > representation for characters into the platform-specific > > encoding used for \code{wchar\_t} and vice versa. In > > particular, on platforms that represent \code{wchar\_t} > > values according to the encoding specified by ISO/IEC > > 10646, this conversion reduces to a simple type cast > > without any alteration of the character values. For all > > other platforms, the exact rules of the conversion are > > platform-specific and not further defined in this report. > > > > Does anybody have any suggestions for improving this > > explanation? > > I don't think we need to say anything special, the conversion > to wchar_t > * is just as defined as that to char *. it is a locale dependent > operation just like withCString and friends. one would make their > decision as to which to use based on the library they are > trying to bind > too, if a wchar_t interface is supported it should be prefered because > it is more likely to preserve character codes.
It is true that strictly speaking we don't need to say anything here. But I think it would be helpful to include a footnote as a guide to implementors, something along the lines of [1] Note that if the platform defines __STDC_ISO_10646__ then wchar_t characters are Unicode code points, and thus the conversion between Haskell Char and CWChar is a simple cast. On other platforms, the translation is locale-dependent just as for CChar. And the paragraph in question could be just The module \code{CString} also exports a variant of the above string marshalling routines for wide characters, i.e. the C \code{wchar_t} type[1]. Cheers, Simon _______________________________________________ FFI mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/ffi