c++ - Invalid conversion from int to wchar_t -
this file code.
file1.cpp
void cime::addexceptkey(wchar_t key) { m_exceptkey.push_back(key); }
file2.cpp
pyobject *imeaddexceptkey(pyobject *poself, pyobject *poargs) { int key; if(!pytuple_getinteger(poargs, 0, &key)) { return py_buildexception(); } cpythonime::instance().addexceptkey(key); return py_buildnone(); }
and warning:
warning c4242: 'argument': conversion 'int' 'wchar_t', possible loss of data
and warning on line :
cpythonime::instance().addexceptkey(key);
what wrong ? tried wchar_t
key no chance.
the size of int may 2 or 4 bytes depending on implementation , size of wchar_t varies between 2,3 or 4 bytes of data. warning there may loss of data. have debug , see if there loss.
Comments
Post a Comment