B
Bryan Parkoff
I have two variables: "char A" and "short B". I can be able to convert
from A to B using explicit case conversion with no problem like "B = short
(A);". Right now, I have two variables: "char T[6]" and "short A". T has
an array of six elements. I desire to capture first element and second
element as two bytes into word as short.
The problem is that "A" captures only one element instead of two
elements. I have looked at machine language and I discovered that C++
Compiler selects the wrong instruction which it uses MOV EAX, BYTE PTR [T]
instead of MOV EAX, WORD PTR [T].
Is there a way how I can fix an error in my source code using explicit
case conversion? I tried to use dynamic_cast<>, but it has the same result.
Here is my example code below.
Bryan Parkoff
int main(void)
{
unsigned char T[6] = { "Bryan" }; // I chose unsigned char for string
instead of char.
unsigned short A;
A = unsigned short (*T); // Should capture "Br"
return 0;
}
from A to B using explicit case conversion with no problem like "B = short
(A);". Right now, I have two variables: "char T[6]" and "short A". T has
an array of six elements. I desire to capture first element and second
element as two bytes into word as short.
The problem is that "A" captures only one element instead of two
elements. I have looked at machine language and I discovered that C++
Compiler selects the wrong instruction which it uses MOV EAX, BYTE PTR [T]
instead of MOV EAX, WORD PTR [T].
Is there a way how I can fix an error in my source code using explicit
case conversion? I tried to use dynamic_cast<>, but it has the same result.
Here is my example code below.
Bryan Parkoff
int main(void)
{
unsigned char T[6] = { "Bryan" }; // I chose unsigned char for string
instead of char.
unsigned short A;
A = unsigned short (*T); // Should capture "Br"
return 0;
}