主要是注册单词 [英] Is main a registered word

查看:103
本文介绍了主要是注册单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好程序员;

我今天加入了。任何人都可以说

关于单词main,它是一个注册单词,证明你的问题

也。我想指出一件事,我们可以制作变量

,名称为main。

谢谢。

解决方案

small TUX写道:


Hello程序员;

我今天加入了。任何人都可以说

关于单词main,它是一个注册单词,证明你的问题

也。我想指出一件事,我们可以使用名称main来制作变量




`main''不是关键字,'main''不是保留的

标识符。有可能(虽然有悖常理)使用`main''

作为宏,变量,结构或

联合标记的名称,或者...


#include< stdio.h>

int main(void){

const char * main = world;

printf(" Hello,%s!\ n",main);

#define main 0

返回主页;

}


(不推荐。)


-

Eric Sosman
es*****@acm-dot-org.inva lid


Eric Sosman< es ***** @ acm-dot-org.invalidwrites:


small TUX写道:


> Hello程序员;
我今天加入了。任何人都可以说
关于main这个词,它是一个注册词,也证明了你的问题。我想指出一件事,我们可以用名称main来制作变量



`main''不是关键字,'main''不是保留的

标识符。有可能(虽然有悖常理)使用`main''

作为宏,变量,结构或

联合标记的名称,或者...


#include< stdio.h>

int main(void){

const char * main = world;

printf(" Hello,%s!\ n",main);

#define main 0

返回主要;

}


(不推荐。)



怎么样主叫作为常规功能?

例如:


#include< stdio.h>


int main( void)

{

printf(" hello");

main();

return(0 );

}


它使用gcc进行无限递归,但我想我听说过你

可以不要叫main,所以这是一个未定义的行为吗?


-

Simias

email rot13-ified


文章< 86 ************ @ simias.hd.free.fr>,

Simias< fv ****** @ tznvy。 pbzwrote:


>它使用gcc进行无限递归,但我想我听说你不能称为main,所以这是一个未定义的行为?



不,调用main()是完全合法的。


我想不到任何相反,

调用另一个函数的情况。 main()的参数旨在便于访问命令行参数,并且这不太可能是一个有用的内部接口。

是一个有用的内部接口。


- Richard


-

应考虑到需要多少人一些字母表中包含32个字符

" - 1963年的X3.4。


Hello programmers;
I joinded today itself. Can anyone say
about the word main, is it a registered word, justify your question
also. I would like to point about one thing that we can make variables
with name main.
Thanks.

解决方案

small TUX wrote:

Hello programmers;
I joinded today itself. Can anyone say
about the word main, is it a registered word, justify your question
also. I would like to point about one thing that we can make variables
with name main.

`main'' is not a keyword, and `main'' is not a reserved
identifier. It is possible (although perverse) to use `main''
as the name of a macro, or of a variable, or of a struct or
union tag, or ...

#include <stdio.h>
int main(void) {
const char *main = "world";
printf ("Hello, %s!\n", main);
#define main 0
return main;
}

(Not recommended.)

--
Eric Sosman
es*****@acm-dot-org.invalid


Eric Sosman <es*****@acm-dot-org.invalidwrites:

small TUX wrote:

>Hello programmers;
I joinded today itself. Can anyone say
about the word main, is it a registered word, justify your question
also. I would like to point about one thing that we can make variables
with name main.


`main'' is not a keyword, and `main'' is not a reserved
identifier. It is possible (although perverse) to use `main''
as the name of a macro, or of a variable, or of a struct or
union tag, or ...

#include <stdio.h>
int main(void) {
const char *main = "world";
printf ("Hello, %s!\n", main);
#define main 0
return main;
}

(Not recommended.)

And what about calling main as a regular function?
e.g.:

#include <stdio.h>

int main(void)
{
printf("hello");
main();
return (0);
}

It makes an infinite recursion with gcc, but i think i''ve heard that you
can''t call main, so is this an undefined behaviour?

--
Simias
email rot13-ified


In article <86************@simias.hd.free.fr>,
Simias <fv******@tznvy.pbzwrote:

>It makes an infinite recursion with gcc, but i think i''ve heard that you
can''t call main, so is this an undefined behaviour?

No, it''s perfectly legal to call main().

I can''t think of any cases where it wouldn''t be clearer to instead
call another function though. main()''s arguments are intended to be
convenient for accessing command line arguments, and that''s unlikely
to be a useful internal interface.

-- Richard


--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.


这篇关于主要是注册单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆