tchar.h, #defines, Cpp to D
Lionello Lunesu
lio at lunesu.remove.com
Tue Sep 12 00:36:45 PDT 2006
The _X() and _T() macros need not be converted. D will automatically
interpret a string constant as ascii (actually utf8!) or wide (utf16)
depending on the variable. You should use alias for the XCHAR (and
TCHAR) type:
// this should be in a translated tchar.h
version(UNICODE) {
alias wchar TCHAR;
alias strcpy _tcscpy;
//etc
} else {
alias ubyte TCHAR;//note that 'char' implies utf8
alias wcscpy _tcscpy;
//etc
}
alias TCHAR XCHAR;
alias _tcscpy STRCPY;
const XCHAR[] XRC = "\r\n";
//etc
I've only seen your TCHAR/XCHAR stuff, so can't comment on the rest.
L.
More information about the Digitalmars-d-learn
mailing list