[英]A compilation problems in VS2015
127: int a = 2815;
00007FF78B5126EE mov dword ptr [a],0AFFh
128:
129: short c = static_cast<char>(a);
00007FF78B5126F5 movsx ax,byte ptr [a]
00007FF78B5126FA mov word ptr [c],ax
In my environment an int
takes 4 byte and a short takes 2, so in the movsx
instruction, why there is a byte not a word?在我的环境中,一个
int
占用 4 个字节,一个 short 占用 2 个字节,所以在movsx
指令中,为什么有一个字节而不是一个字? Hope someone can help me!希望可以有人帮帮我!
A char
is one byte.一个
char
是一个字节。 The static_cast
casts a
to a char
. static_cast
将a
转换为char
。 One byte.一个字节。 Hence, the one-byte value of the
char
-cast variable a
is moved into ax
.因此,
char
转换变量a
的一字节值被移动到ax
。
它移动 int a
的最低字节,因为这是static_cast<char>
给你的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.