申报人问题 [英] Declarator question
问题描述
如果这真的很愚蠢,请提前抱歉,但我试图让我的
完全按照声明者的说法。在FAQ,1.21,
的一部分,它说C声明......分为两部分,一个基本类型和一个
声明者..... 。
使用的示例是char * pc,其中声明符 * PC"告诉我们
* pc是一个字符。
因此可以宽泛地说一个声明者实际上相当于
基类型吗?
因此,在一个更复杂的表达式中,例如char *(* pfpc)();一次
再次*(* pfpc)()是一个角色?
像往常一样感谢。
Sorry in advance if this is really dumb, but I am trying to get my
head around exactly what the declarator is. In the FAQ, 1.21, part of
it says "C declarations ....come in 2 parts, a base type and a
declarator......".
The example used is char *pc where the declarator " *pc" tells us
that " *pc is a character".
Can one thus broadly say that a declarator is in fact equivalent to
the base type?
So, in a more complicated expression eg char * ( *pfpc) () ; once
again "* ( *pfpc) ()" is a character?
Thanks as usual.
推荐答案
mdh写道:
mdh wrote:
如果这真的很愚蠢,请提前抱歉,但我试图让我的
完全按照声明者的说法进行操作。在FAQ,1.21,
的一部分,它说C声明......分为两部分,一个基本类型和一个
声明者..... 。
使用的示例是char * pc,其中声明符 * PC"告诉我们
* pc是一个字符。
因此可以宽泛地说一个声明者实际上相当于基本类型的基础类型吗?
Sorry in advance if this is really dumb, but I am trying to get my
head around exactly what the declarator is. In the FAQ, 1.21, part of
it says "C declarations ....come in 2 parts, a base type and a
declarator......".
The example used is char *pc where the declarator " *pc" tells us
that " *pc is a character".
Can one thus broadly say that a declarator is in fact equivalent to
the base type?
在`char * pc'中,基类型是`char'',声明符是
` * pc''。声明 - 两个部分合在一起 - 表示
声明者具有基本类型:在这种情况下,`* pc''具有
类型`char' 。在程序的后面,你写的任何地方`* pc''你
写了一个类型为`char''的表达式。
In `char *pc'' the base type is `char'' and the declarator is
`*pc''. The declaration -- both pieces taken together -- says that
the declarator has the base type: in this case, `*pc'' has the
type `char''. Later in the program, any place you write `*pc'' you
have written an expression whose type is `char''.
因此,在更复杂的表达中,例如char *(* pfpc)();一次
再次*(* pfpc)()是一个角色?
So, in a more complicated expression eg char * ( *pfpc) () ; once
again "* ( *pfpc) ()" is a character?
是的。一个看起来像声明符的表达式有一个类型,
,该类型是声明中的基本类型。
-
Er ********* @ sun.com
>
7月16日上午10:54 *,Eric Sosman< Eric.Sos ... @ sun.comwrote:
On Jul 16, 10:54*am, Eric Sosman <Eric.Sos...@sun.comwrote:
>
* * *在`char * pc''基类型是`char'',声明符是
` * pc''。 *声明 - 两个部分合在一起 - 表示
声明者具有基本类型:在这种情况下,`* pc''具有
类型`char ''。 *在程序的后面,任何你写'* pc''你
的地方都写了一个类型为'char''的表达式。
>
* * *In `char *pc'' the base type is `char'' and the declarator is
`*pc''. *The declaration -- both pieces taken together -- says that
the declarator has the base type: in this case, `*pc'' has the
type `char''. *Later in the program, any place you write `*pc'' you
have written an expression whose type is `char''.
谢谢Eric。多一点探测。
现在,如果在''const char'等中添加像''const''这样的限定符,那么
类型现在是''const char''?
thanks Eric. A little more probing.
Now if one adds a qualifyer like ''const'' as in ''const char'' etc,is the
type now ''const char'' ?
mdh写道:
mdh wrote:
7月16日,上午10:54,Eric Sosman< Eric.Sos ... @ sun.comwrote:
On Jul 16, 10:54 am, Eric Sosman <Eric.Sos...@sun.comwrote:
>在`char * pc''中,基类型是`char'',声明符是
`* pc''。声明 - 两个部分合在一起 - 表示声明者具有基本类型:在这种情况下,`* pc''具有
类型`char''。在程序的后面,你写* pc的任何地方你都写了一个类型为char的表达式。
> In `char *pc'' the base type is `char'' and the declarator is
`*pc''. The declaration -- both pieces taken together -- says that
the declarator has the base type: in this case, `*pc'' has the
type `char''. Later in the program, any place you write `*pc'' you
have written an expression whose type is `char''.
>
谢谢Eric。多一点探测。
现在,如果在''const char'等中添加像''const''这样的限定符,那么
类型现在是''const char''?
thanks Eric. A little more probing.
Now if one adds a qualifyer like ''const'' as in ''const char'' etc,is the
type now ''const char'' ?
是;它是一种合格的类型。类型限定符是
const,volatile和(C99中的新增)限制,它们可以单独使用,或者(当然)完全不使用
。
-
Eric Sosman
es ***** @ ieee-dot-org.inva 盖子
这篇关于申报人问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!