typedef forward声明 [英] typedef forward declare

查看:69
本文介绍了typedef forward声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




使用关键字struct,我们可以简单地通过以下方式进行前向声明:

struct struct_a;


但如果我们输入它:


typdef struct struct_a struct_a_t;


当我们需要使用struct_a_t但十字架时包含发生,如何
告诉编译器struct_a_t是一个类型?好像是:


类型struct_a_t;


谢谢。

ABAI

- -

comp.lang.c.moderated - 审核地址: cl**@plethora.net - 你必须

在您的标题中有适当的新闻组行,以便查看您的邮件,

或主题行中方括号中的新闻组名称。对不起。

Hi,

With keyword struct, we can simply do forward declare by:

struct struct_a;

but if we typedef it:

typdef struct struct_a struct_a_t;

When we need to use struct_a_t but the cross include occurs, how to
tell compiler that struct_a_t is a type? seems like:

type struct_a_t;

Thanks.
ABAI
--
comp.lang.c.moderated - moderation address: cl**@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.

推荐答案

嗨Binary(不错的一个;)),


通常你是wud声明typedef分成一个标题

文件,并在所有文件中包含该头文件。当每个文件编译为
时,标题信息包含在预处理阶段,因此

你的typedefnition.Thats编译器如何知道

typedef作为数据类型。


欢呼,

Kaushal。


Binary写道:
Hi Binary(nice one ;) ),

Usually u wud declare the typedef part in a header
file,and include that header file in all the filese.When each file is
compiled,the header info gets included at preprocessing stage and hence
ur typedefnition.Thats how the complier would get to know about the
typedef as datatype.

cheers,
Kaushal.

Binary wrote:




使用关键字struct,我们可以简单地通过以下方式进行前向声明:

struct struct_a;


但是如果我们输入它:


typdef struct struct_a struct_a_t;

当我们需要使用struct_a_t但是发生交叉包含时,如何使用
告诉编译器struct_a_t是一种类型?好像是:


类型struct_a_t;


谢谢。

ABAI

- -

comp.lang.c.moderated - 审核地址: cl**@plethora.net - 你必须

在您的标题中有适当的新闻组行,以便查看您的邮件,

或主题行中方括号中的新闻组名称。抱歉。
Hi,

With keyword struct, we can simply do forward declare by:

struct struct_a;

but if we typedef it:

typdef struct struct_a struct_a_t;

When we need to use struct_a_t but the cross include occurs, how to
tell compiler that struct_a_t is a type? seems like:

type struct_a_t;

Thanks.
ABAI
--
comp.lang.c.moderated - moderation address: cl**@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.



-

comp.lang.c.moderated - 审核地址: cl ** @ plethora.net - 您必须

在您的标题中有适当的新闻组行,以便查看您的邮件,

或主题行中方括号中的新闻组名称。对不起。

--
comp.lang.c.moderated - moderation address: cl**@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.


krishna写道:
krishna wrote:

你喜欢Binary(很棒的一个;)),


通常你wud
Hi Binary(nice one ;) ),

Usually u wud



这是我经常停止阅读的地方。

我可以忍受偶尔的拼写错误,我可以使用明显的

语言Defizit,但技术新闻组中的小孩谈话是难以忍受的。

我希望你永远不需要问一个我能回答的问题。 br $>
-

Josef M?llers(Pinguinpfleger bei FSC)

如果失败没有罚款成功将不会是奖金

- T. Pratchett

-

comp.lang.c.moderated - 审核地址: cl ** @ plethora.net - 您必须

在您的标题中有适当的新闻组行,以便查看您的邮件,

或主题行中方括号中的新闻组名称。抱歉。

This is where I usually stop reading.
I can live with the occasional speling eror, I can live with the obvious
language Defizit, but kiddie talk in a technical newsgroup is unbearable.
I hope you never need to ask a question I could answer.
--
Josef M?llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
--
comp.lang.c.moderated - moderation address: cl**@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.


krishna写道:
krishna wrote:

嗨二进制(很棒的一个;)),


通常你在标题

文件中声明typedef部分,并在所有文件中包含该头文件。当每个文件都是

编译时,标题信息包含在预处理阶段,因此

你的typedefnition.Thats编译器将如何知道

typedef作为数据类型。


欢呼,

Kaushal。


Binary写道:
Hi Binary(nice one ;) ),

Usually u wud declare the typedef part in a header
file,and include that header file in all the filese.When each file is
compiled,the header info gets included at preprocessing stage and hence
ur typedefnition.Thats how the complier would get to know about the
typedef as datatype.

cheers,
Kaushal.

Binary wrote:

> ;

使用关键字struct,我们可以简单地通过以下方式进行前向声明:

struct struct_a;

但如果我们输入它:

typdef struct struct_a struct_a_t;

当我们需要使用struct_a_t但发生交叉包含时,如何告诉编译器struct_a_t是一个类型?好像是:

类型struct_a_t;

谢谢。
ABAI
-
comp.lang.c.moderated - 审核地址: cl**@plethora.net - 您必须在标题中添加适当的新闻组,才能使您的邮件成为
在主题行的方括号中看到,
或新闻组名称。抱歉。
>Hi,

With keyword struct, we can simply do forward declare by:

struct struct_a;

but if we typedef it:

typdef struct struct_a struct_a_t;

When we need to use struct_a_t but the cross include occurs, how to
tell compiler that struct_a_t is a type? seems like:

type struct_a_t;

Thanks.
ABAI
--
comp.lang.c.moderated - moderation address: cl**@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line. Sorry.



我可以请你在usenet上避免发短信吗? -

令人愤怒的尝试和阅读。

谢谢,

Eric

-

comp.lang.c.moderated - 审核地址: cl**@plethora.net - 你必须

在您的标题中有一个适当的新闻组行,以便查看您的邮件,

或主题行中方括号中的新闻组名称。对不起。

Could I ask you to PLEASE refrain from text messaging on usenet? - its
infuriating to try and read.
Thanks,
Eric
--
comp.lang.c.moderated - moderation address: cl**@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.


这篇关于typedef forward声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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