我只是想知道这段奇葩的代码是怎么跑起来的(#惊哭)
c语言吧
全部回复
仅看楼主
level 12
double *ip = (int *)malloc(sizeof(char));
*ip = 123456.7890;
printf("%lf", *ip);
它输出成功了,没错,竟然成功了[笑眼]我用来做死的代码没有死
用malloc创建一个字节,把地址强制转换为in*,再返回给double*,这都能运行,我简直无法理解啊[狂汗]
Next Page >
Image Resolution: 460× 780× 980x  
2015年04月24日 16点04分 1
level 13
只能说你的编译器不严谨
2015年04月24日 22点04分 2
level 13
[汗]作死代码有什么说的,某些环境下直接段错误
2015年04月24日 22点04分 3
level 10
[呵呵]
2015年04月24日 23点04分 4
level 13
当然你想要喜闻乐见的error,也是可以看到的
2015年04月24日 23点04分 5
level 10
每个编译器的检查规则不同
2015年04月25日 00点04分 6
level 4
内存管理粒度问题,一般都不会太小,比如 8
2015年04月25日 01点04分 7
1