Passing string from D to c++

Ali Çehreli acehreli at yahoo.com
Tue Jul 30 22:56:12 PDT 2013


On 07/30/2013 02:17 PM, JS wrote:

 > A C++ string is null terminated while a D string is not.

I think the OP means std::string, which also is not zero-terminated. (On 
the other hand, C strings are zero-terminated.)

 > If you pass a D string to C++ then it will not have the same length 
and give
 > undesirable behavior.

That's an important consideration. char is not UTF-8 code unit in C and C++.

Ali



More information about the Digitalmars-d mailing list