一个无声的错误 [英] a silent error
问题描述
它对于以下程序的标准是什么?
它必须运行与否?或者它是UB?
更好地知道有错误或可移植性?
它是用gcc编译和运行的吗?
-------------------------------
#include< stdio.h>
int main(无效)
{char * p =" 123";
printf(" jijdid \ n",p);
返回0;
}
------------- ------------------
what does it say the standard for below program?
it has to run or not? or it is UB?
it is better know there is a error or the portability?
it compile and run with gcc?
-------------------------------
#include <stdio.h>
int main(void)
{char *p="123";
printf("jijdid\n", p);
return 0;
}
-------------------------------
推荐答案
RoS写道:
RoS wrote:
它对于以下程序的标准是什么?
它必须运行与否?或者它是UB?
更好地知道有错误或可移植性?
它是用gcc编译和运行的吗?
-------------------------------
#include< stdio.h>
int main(无效)
{char * p =" 123";
printf(" jijdid \ n",p);
返回0;
}
what does it say the standard for below program?
it has to run or not? or it is UB?
it is better know there is a error or the portability?
it compile and run with gcc?
-------------------------------
#include <stdio.h>
int main(void)
{char *p="123";
printf("jijdid\n", p);
return 0;
}
它调用未定义的行为。
It invokes undefined behaviour.
数据周一,2007年12月3日17:21:48 +0100,RoS scrisse:
- -------------------
In data Mon, 03 Dec 2007 17:21:48 +0100, RoS scrisse:
--------------------
> #include< stdio.h>
int main(void)
{char * p =" 123";
printf(" jijdid \ n",p);
返回0;
}
-------------------------------
>#include <stdio.h>
int main(void)
{char *p="123";
printf("jijdid\n", p);
return 0;
}
-------------------------------
对我来说似乎不是错误
for me not seem an error
RoS写道:
RoS wrote:
数据周一,2007年12月3日1 7:21:48 +0100,RoS scrisse:
In data Mon, 03 Dec 2007 17:21:48 +0100, RoS scrisse:
>> #include< stdio.h> ;
int main(void)
{char * p =" 123" ;;
printf(" jijdid \ n",p);
返回0;
}
>>#include <stdio.h>
int main(void)
{char *p="123";
printf("jijdid\n", p);
return 0;
}
>
对我来说似乎不是错误
>
for me not seem an error
这是未定义行为的一种可能结果。
Which is one possible outcome of Undefined behaviour.
这篇关于一个无声的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!