该计划标准是否符合要求? [英] Is this program standard conform?
问题描述
以下程序标准是否符合?
(尽可能减少,因此仍然显示问题)
/ * begin * /
#include< stdio.h>
void xfprintf(FILE *);
void xfprintf(FILE * f){
fprintf(f," x \ n");
}
int main(void) {
xfprintf(stderr);
返回0;
}
/ * end * /
它在没有警告的情况下使用gcc进行编译并且工作正常,但是尝试使用特定的其他流行的编译器来编译它,它会在诊断后生成
:
lc -ansic -A -shadows -unused -O -c xfprintf.c -o xfprintf.obj
错误xfprintf.c:4重新定义'' xfprintf''
错误c:\ lcc\include\stdio.h:116此前''xfprintf''的先前定义
2错误,0警告
1错误
make:*** [xfprintf.obj]错误1
谁在这里,我的程序或编译器有问题?
1月21日,3日:上午13点,Fumeur< f ... @ invalid.invalidwrote:
以下程序标准是否符合?
(减少为尽可能这样它仍然显示问题)
/ * begin * /
#include< stdio.h>
>
void xfprintf(FILE *);
void xfprintf(FILE * f){
fprintf(f," x \ n" ;);
}
int main(无效){
xfprintf(stderr);
返回0;}
/ *结束* /
它使用gcc编译而没有警告并且工作正常,但是尝试
用特定的其他流行的编译器编译它,它在诊断后产生
:
lc -ansic -A - shadows -unused -O -c xfprintf.c -o xfprintf.obj
错误xfprintf.c:4 redefinit ''xfprintf'的离子'
错误c:\ csc\include\stdio.h:116此前''xfprintf''的先前定义
2错误,0警告
1错误
make:*** [xfprintf.obj]错误1
谁在这里有过错,我的程序还是编译器?
int foo(void); int foo(void){return 42; }是
a定义。
显然,xfprintf()定义了两次。
你的代码片段是有效的ISO C.
在文章< 26 **************** @ aioe.org> ;, Fumeur< f6@invalid.invalidwrote:
< blockquote class =post_quotes>
> lc -ansic -A -shadows -unused -O -c xfprintf.c -o xfprintf.obj
错误xfprintf.c:4重新定义''xfprintf' '
错误c:\ clcc \ include \ stdio.h:116''xfprintf''的先前定义'
请不要''喂匿名巨魔。
- Richard
-
:wq
< br>
Richard Tobin写道:
Fumeur< f6@invalid.invalidwrote:
> lc -ansic -A -shadows -unused -O -c xfprintf.c -o xfprintf.obj
错误xfprintf.c:4重新定义''xfprintf''
错误c:\ LCC \\include\stdio.h:116
xfprintf的先前的定义这里
就别喂匿名巨魔。
为什么你认为Fumeur是一个巨魔?
-
[mail ]:Chuck F(cinefalconer at maineline dot net)
[page]:< http://cbfalconer.home.att.net>
尝试下载部分。
-
通过 http://www.teranews.com
Is the following program standard conform?
(reduced as much as possible so it still shows the problem)
/* begin */
#include <stdio.h>
void xfprintf(FILE *);
void xfprintf(FILE *f) {
fprintf(f, "x\n");
}
int main(void) {
xfprintf(stderr);
return 0;
}
/* end */
It compiles with gcc without warnings and works correctly, but trying
to compile it with a particular other popular compiler, it yields the
following diagnostics:
lc -ansic -A -shadows -unused -O -c xfprintf.c -o xfprintf.obj
Error xfprintf.c: 4 redefinition of ''xfprintf''
Error c:\lcc\include\stdio.h: 116 Previous definition of ''xfprintf'' here
2 errors, 0 warnings
1 error
make: *** [xfprintf.obj] Error 1
Who is at fault here, my program or the compiler?
On Jan 21, 3:13 am, Fumeur <f...@invalid.invalidwrote:Is the following program standard conform?
(reduced as much as possible so it still shows the problem)
/* begin */
#include <stdio.h>
void xfprintf(FILE *);
void xfprintf(FILE *f) {
fprintf(f, "x\n");
}
int main(void) {
xfprintf(stderr);
return 0;}
/* end */
It compiles with gcc without warnings and works correctly, but trying
to compile it with a particular other popular compiler, it yields the
following diagnostics:
lc -ansic -A -shadows -unused -O -c xfprintf.c -o xfprintf.obj
Error xfprintf.c: 4 redefinition of ''xfprintf''
Error c:\lcc\include\stdio.h: 116 Previous definition of ''xfprintf'' here
2 errors, 0 warnings
1 error
make: *** [xfprintf.obj] Error 1
Who is at fault here, my program or the compiler?int foo(void); is a declaration while int foo(void) { return 42; } is
a definition.
Apparently, xfprintf() is defined twice.
Your snippet is valid ISO C.
In article <26****************@aioe.org>, Fumeur <f6@invalid.invalidwrote:
>lc -ansic -A -shadows -unused -O -c xfprintf.c -o xfprintf.obj
Error xfprintf.c: 4 redefinition of ''xfprintf''
Error c:\lcc\include\stdio.h: 116 Previous definition of ''xfprintf'' herePlease don''t feed the anonymous troll.
-- Richard
--
:wq
Richard Tobin wrote:Fumeur <f6@invalid.invalidwrote:
>lc -ansic -A -shadows -unused -O -c xfprintf.c -o xfprintf.obj
Error xfprintf.c: 4 redefinition of ''xfprintf''
Error c:\lcc\include\stdio.h: 116
Previous definition of ''xfprintf'' here
Please don''t feed the anonymous troll.Why do you consider Fumeur to be a troll?
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
这篇关于该计划标准是否符合要求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!