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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -