小编kar*_*hta的帖子

GCC编译时分错误

有人可以解释这种行为吗?

test.c的:

#include <stdio.h>

int main(void)
{
    printf("%d, %d\n", (int) (300.6000/0.05000), (int) (300.65000/0.05000));
    printf("%f, %f\n", (300.6000/0.05000), (300.65000/0.05000));
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

$ gcc test.c

$ ./a.out
6012, 6012
6012.000000, 6013.000000
Run Code Online (Sandbox Code Playgroud)

我检查了汇编代码,它将第一个printf的参数都设置为6012,所以它似乎是一个编译时错误.

c compiler-construction gcc

2
推荐指数
2
解决办法
344
查看次数

标签 统计

c ×1

compiler-construction ×1

gcc ×1