www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - wchar usage in std.c.stdio module

Phobos module std/c/stdio.d:

The current dmd code uses "wchar",
but the Unix functions use wint_t

To match the C versions, they *really*
should use the wint_t / wchar_t types...


<stddef.h>
 "wchar_t"
 Integral type whose range of values can represent distinct
 wide-character codes for all members of the largest character set
 specified among the locales supported by the compilation environment

<wchar.h>
 "wint_t"
 An integral type capable of storing any valid value of wchar_t,
 or WEOF.

Could probably use type "wchar_t" in D too: "version (Windows) { alias wchar wchar_t; } else version (Unix) { alias dchar wchar_t; }" And declare the macros: (would be D constants)
 WCHAR_MAX
     The maximum value representable by an object of type wchar_t. 
 WCHAR_MIN
     The minimum value representable by an object of type wchar_t. 
 WEOF
     Constant expression of type wint_t that is returned to indicate
end-of-file.

--anders
Nov 21 2004