Hello everyone,
I think I am missing smth back in my theoretical background on this thing. I know there were similar posts but I still do not get it.
I have such a code:
void somefunc1(Word &Key)
{
somefunc2(Key);
}
void somefunc2(char &char1)
{
return;
}
compiler generates me an error here:
somefunc2(Key);
[BCC32 Error] Unit1.cpp(830): E2357 Reference initialized with 'unsigned short', needs lvalue of type 'char'
I found out that it is because of the ANSI 2003 regulation on C++ dealing with temporaries and references but I still do not get what is wrong here.
when I do c-style conversion:
somefunc2( *(char*)&Key )
it resolves an issue.
Can anyone hint me what is wrong and why is it wrong?