我正在学习MOV汇编中的数据移动()。
我尝试编译一些代码以查看 x86_64 Ubuntu 18.04 机器中的程序集:
typedef unsigned char src_t;
typedef xxx dst_t;
dst_t cast(src_t *sp, dst_t *dp) {
*dp = (dst_t)*sp;
return *dp;
}
Run Code Online (Sandbox Code Playgroud)
哪里。src_t unsigned char至于,dst_t我试过了char,,short和int。long结果如下所示:
// typedef unsigned char src_t;
// typedef char dst_t;
// movzbl (%rdi), %eax
// movb %al, (%rsi)
// typedef unsigned char src_t;
// typedef short dst_t;
// movzbl (%rdi), %eax
// movw %ax, (%rsi)
// typedef unsigned …Run Code Online (Sandbox Code Playgroud) 这是我的 C 代码:
char *ptr = "0xfff1342809062Cac";
char *pEnd;
long long value = strtoll(ptr, &pEnd, 0);
printf("%lld\n", value);
printf("errno: %d\n", errno);
Run Code Online (Sandbox Code Playgroud)
我是用gcc-8.3.0编译的,输出是:
9223372036854775807
errno: 34
Run Code Online (Sandbox Code Playgroud)
我很困惑 strtoll 给出了一个意想不到的值并将 errno 设置为 34。