raj*_*han 14 c++ floating-point powerpc ieee-754 embedded-linux
当我在支持软件浮动仿真(硬件浮点禁用)的32位powerpc内核中运行以下C++程序时,我得到了错误的条件评估.有人可以告诉我这里有什么潜在的问题吗?
#include <stdio.h>
int main() {
int newmax = 1;
if ((newmax + 0.0) > 256) {
printf("\nShouldn't be here\n");
} else {
printf("\nShould be here\n");
}
}
Run Code Online (Sandbox Code Playgroud)
编译:
powerpc-linux-g++ -msoft-float -c floating.cxx
powerpc-linux-g++ -o floating floating.o
Run Code Online (Sandbox Code Playgroud)
目标系统中的输出:
[linux:/]$ ./floating
Shouldn't be here
Run Code Online (Sandbox Code Playgroud)
小智 1
您还应该在链接时指定 -msoft-float 给我们使用 -S 标志进行反汇编: powerpc-linux-g++ -msoft-float -c float.cxx -S -o float.s
| 归档时间: |
|
| 查看次数: |
1080 次 |
| 最近记录: |