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

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 26 19:40:50 PST 2015


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.


More information about the Digitalmars-d-learn mailing list