Comment #12 on issue 336 by eyal.far...@gmail.com: Support generic string type
http://code.google.com/p/protobuf/issues/detail?id=336

the warning I'm referring to is regarding the truncation of wchar_t to char, this will cause a loss of data in case your wchar_t contains a value higher than 256, and will probably do the wrong thing for values in the range [128..256).

Now, having that said, I couldn't reproduce this warning with std::basic_string, but I do have a sample of the warning I was talking about:

#include <string>


int main(int argc, char* argv[])
{
        wchar_t w = 300;
        std::wstring    ww( 10, w );
        //surprisingly enough, no warning here
        std::string             aa( ww.c_str(), ww.c_str() + ww.size() );
        aa.assign( ww.c_str(), ww.c_str() + ww.size() );

        //this does generate a warning
        aa[ 2 ] = w;
//1>c:\users\eyal\documents\visual studio 2005\projects\sample_cpp\sample_cpp\sample_cpp.cpp(18) : warning C4244: '=' : conversion from 'wchar_t' to 'char', possible loss of data

        return 0;
}

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to