argument type const char* can pass string, buf why const wchar* can not pass wstring

riki via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 26 20:07:47 PST 2015


On Sunday, 27 December 2015 at 03:40:50 UTC, Alex Parrill wrote:
> On Sunday, 27 December 2015 at 03:34:18 UTC, riki wrote:
>> void ccf(const char* str){}
>> void cwf(const wchar* str){}
>>
>> void main()
>> {
>>     ccf("aaa");    //ok
>>     cwf("xxx"w); // error and why ?
>> }
>
> Unrelated to your error, but those functions should probably 
> take a `string` and `wstring` respectively instead.

xx.d(7): Error: function xx.cwf (const(wchar*) str) is not 
callable using argument types (wstring)


More information about the Digitalmars-d-learn mailing list