优先权 [英] precedence

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

问题描述

声明:


foo.b [0] = 7;


表示数据的数组成员的第一个元素结构体。我的

问题是,为什么在优先级图表中括号更高之后,首先是点运算符

之后是否先评估括号?谢谢

the statement:

foo.b[0] = 7;

indicates the first element of the array member of the data structure. My
question is, why aren''t the brackets evaluated first then the dot operator
after since the brackets are higher on the precedence chart? Thanks

推荐答案



" Andy White" <峰; br *********** @ msn.com> schrieb im Newsbeitrag

新闻:10 ************* @ corp.supernews.com ...

"Andy White" <br***********@msn.com> schrieb im Newsbeitrag
news:10*************@corp.supernews.com...
声明:

foo.b [0] = 7;

表示数据结构的数组成员的第一个元素。我的问题是,为什么在优先级图表中括号更高之后,首先不会对点
运算符进行括号评估?谢谢
the statement:

foo.b[0] = 7;

indicates the first element of the array member of the data
structure. My
question is, why aren''t the brackets evaluated first then the dot
operator
after since the brackets are higher on the precedence chart? Thanks




呃...首先评估大括号的内容:


long fkt(void)

{

printf(" fkt");

返回0;

}


class FOO

{

public:

long& B(){printf(" access B");返回b;}

长b;

};


FOO foo [100];

foo.B()[fkt()] = 7;



Er... The content of the braces _is_ evaluated first:

long fkt(void)
{
printf("fkt");
return 0;
}

class FOO
{
public:
long& B(){printf("access B "); return b;}
long b;
};

FOO foo[100];
foo.B()[fkt()] = 7;


在文章< 10 ************* @ corp。 supernews.com>,Andy White

< br *********** @ msn.com>写
In article <10*************@corp.supernews.com>, Andy White
<br***********@msn.com> writes
语句:

foo.b [0] = 7;

表示数据结构的数组成员的第一个元素。我的问题是,为什么在优先级图表上的括号更高之后,首先不会对括号运算符进行括号评估?谢谢
the statement:

foo.b[0] = 7;

indicates the first element of the array member of the data structure. My
question is, why aren''t the brackets evaluated first then the dot operator
after since the brackets are higher on the precedence chart? Thanks




因为你从名字开始,在这种情况下''foo''下标

运算符不适合foo,并且b不是自由变量,但是在foo的上下文中确定了一个



-

Francis Glassborow ACCU
你可以做到!的作者参见 http:// www .spellen.org / youcandoit

对于项目构想和贡献: http://www.spellen.org/youcandoit/projects



Because you start from the name, in this case ''foo'' The subscript
operator is not appropriate to foo, and b isn''t a free variable but one
that is identified in the context of foo.
--
Francis Glassborow ACCU
Author of ''You Can Do It!'' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects




" Andy White" <峰; br *********** @ msn.com>在消息中写道

news:10 ************* @ corp.supernews.com ...

"Andy White" <br***********@msn.com> wrote in message
news:10*************@corp.supernews.com...
声明:

foo.b [0] = 7;

表示数据结构的数组成员的第一个元素。我的问题是,为什么在优先级图表上的括号更高之后,首先不会对括号运算符进行括号评估?谢谢
the statement:

foo.b[0] = 7;

indicates the first element of the array member of the data structure. My
question is, why aren''t the brackets evaluated first then the dot operator
after since the brackets are higher on the precedence chart? Thanks




A''[]''运算符的优先级不高于''。''运算符。他们

具有相同的优先权。


问候,

Sumit。



A ''[]'' operator does not have higher precedence than a ''.'' operator. They
have the SAME precedence.

Regards,
Sumit.


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

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