Rename std.string.toStringz?

KennyTM~ kennytm at gmail.com
Thu Jun 16 09:07:22 PDT 2011


On Jun 16, 11 23:09, Regan Heath wrote:
> On Thu, 16 Jun 2011 13:00:23 +0100, Timon Gehr <timon.gehr at gmx.ch> wrote:
>
>> Daniel Gibson wrote:
>>> Am 16.06.2011 08:30, schrieb Jonathan M Davis:
>>>
>>>>
>>>> 3. Rename it to toCString (probably renaming toUTF16z to something like
>>>> toWCString), so it's then more recognizable to newbies
>>>
>>> This + keep around aliases for the old names until D3.
>
> +1
>
>> +1. But make it 'toCWString'. :o)
>
> Or toWString (looks nicer to me).
>

A potential problem is that an immutable(wchar)[] is wstring.

> Or toCStr and toWStr (to save 3 characters on each).
>
> winnt.h defines many similar types:
>
> typedef __nullterminated WCHAR *NWPSTR, *LPWSTR, *PWSTR;
> typedef __nullterminated PWSTR *PZPWSTR;
> typedef __nullterminated CONST PWSTR *PCZPWSTR;
> typedef __nullterminated WCHAR UNALIGNED *LPUWSTR, *PUWSTR;
> typedef __nullterminated CONST WCHAR *LPCWSTR, *PCWSTR;
> typedef __nullterminated PCWSTR *PZPCWSTR;
> typedef __nullterminated CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR;
>
> so variations on any of those make sense.
>
> .. I think the toStringz probably came from the winnt.h defines using z..
>
> typedef __nullterminated CHAR *NPSTR, *LPSTR, *PSTR;
> typedef __nullterminated PSTR *PZPSTR;
> typedef __nullterminated CONST PSTR *PCZPSTR;
> typedef __nullterminated CONST CHAR *LPCSTR, *PCSTR;
> typedef __nullterminated PCSTR *PZPCSTR;
>

Stringz means "Z"ero-terminated "String". The usage predates Windows NT.


More information about the Digitalmars-d mailing list