Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

set WCHAR to wchar_t for future #2390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/core/sys/windows/winnt.d
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,22 @@ FIELD_OFFSET(t,f), CONTAINING_RECORD(address, type, field)

alias void VOID;
alias char CHAR, CCHAR;
alias wchar WCHAR;

/* #if !defined(_NATIVE_WCHAR_T_DEFINED)
* typedef unsigned short WCHAR;
* #else
* typedef wchar_t WCHAR;
* #endif
*
* References:
* https://docs.microsoft.com/en-us/windows/desktop/extensiblestorageengine/gg269344(v%3Dexchg.10)
* https://docs.microsoft.com/en-au/cpp/build/reference/zc-wchar-t-wchar-t-is-native-type?view=vs-2017
*/
version (Cpp98)
Copy link
Contributor

@TurkeyMan TurkeyMan Dec 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still have a moderate objection to this version name... cpp98 is not what's being expressed here. It's really just "old DMD behaviour".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version (Cpp98) version (CppRuntimeDigitalMars) would do the trick.

alias wchar WCHAR;
else
alias wchar_t WCHAR;

alias bool BOOLEAN;
alias byte FCHAR;
alias ubyte UCHAR;
Expand All @@ -33,7 +48,7 @@ alias ulong DWORDLONG, ULONGLONG;

alias void* PVOID, LPVOID;
alias char* PSZ, PCHAR, PCCHAR, LPCH, PCH, LPSTR, PSTR;
alias wchar* PWCHAR, LPWCH, PWCH, LPWSTR, PWSTR;
alias WCHAR* PWCHAR, LPWCH, PWCH, LPWSTR, PWSTR;
alias bool* PBOOLEAN;
alias ubyte* PUCHAR;
alias short* PSHORT;
Expand All @@ -47,7 +62,7 @@ alias void* PVOID64;

// const versions
alias const(char)* PCCH, LPCCH, PCSTR, LPCSTR;
alias const(wchar)* LPCWCH, PCWCH, LPCWSTR, PCWSTR;
alias const(WCHAR)* LPCWCH, PCWCH, LPCWSTR, PCWSTR;

version (Unicode) {
alias WCHAR TCHAR, _TCHAR;
Expand All @@ -60,7 +75,7 @@ alias TCHAR* PTCH , PTBYTE, LPTCH , PTSTR , LPTSTR , LP, PTCHAR;
alias const(TCHAR)* PCTCH, LPCTCH, PCTSTR, LPCTSTR ;

enum char ANSI_NULL = '\0';
enum wchar UNICODE_NULL = '\0';
enum WCHAR UNICODE_NULL = '\0';

enum APPLICATION_ERROR_MASK = 0x20000000;
enum ERROR_SEVERITY_SUCCESS = 0x00000000;
Expand Down