b*d
2 楼
int i = 1;
int j = 2;
int k = i +++ j;
k?
i?
j?
int j = 2;
int k = i +++ j;
k?
i?
j?
v*d
3 楼
...
v*d
5 楼
怎么换另一个形象啊 我换衣服了啊
怎么还是这个
怎么还是这个
v*d
7 楼
。。。
l*8
8 楼
The parser/tokenizer will always try to match the longest string. Therefore
when it encounters a sequence of "i+++j" it will generate four tokens:
(1) identifier "i"
(2) operator "++"
(3) operator "+"
(4) identifier "j"
when it encounters a sequence of "i+++j" it will generate four tokens:
(1) identifier "i"
(2) operator "++"
(3) operator "+"
(4) identifier "j"
v*d
9 楼
,,
v*d
11 楼
晕 不会用
v*d
13 楼
now
b*d
14 楼
that's totally true.
so i++j is wrong, but i+ +j is okay.
Therefore
【在 l***8 的大作中提到】
: The parser/tokenizer will always try to match the longest string. Therefore
: when it encounters a sequence of "i+++j" it will generate four tokens:
: (1) identifier "i"
: (2) operator "++"
: (3) operator "+"
: (4) identifier "j"
so i++j is wrong, but i+ +j is okay.
Therefore
【在 l***8 的大作中提到】
: The parser/tokenizer will always try to match the longest string. Therefore
: when it encounters a sequence of "i+++j" it will generate four tokens:
: (1) identifier "i"
: (2) operator "++"
: (3) operator "+"
: (4) identifier "j"
t*t
16 楼
it is defined in C++ standard, but your reason is wrong
it is defined in the tokenization process.
【在 b*****d 的大作中提到】
: In fact, it is defined in C++ standard.
: The reason is i++ has higher precedence than ++i.
: Surprisingly.
: so, i +++ j is
: (i++)+j rather than
: i+ (++j).
: VS 2008 gives the correct answer.
it is defined in the tokenization process.
【在 b*****d 的大作中提到】
: In fact, it is defined in C++ standard.
: The reason is i++ has higher precedence than ++i.
: Surprisingly.
: so, i +++ j is
: (i++)+j rather than
: i+ (++j).
: VS 2008 gives the correct answer.
w*i
19 楼
somehow remind me of 茴香豆的茴字有几种写法, hehe
l*8
20 楼
>> how about i +++j
No, "i +++j" is still tokenized as "i", "++", "+", "j".
This has nothing to do with operator precedence.
To force the parser to recognize (++j), you need to put a space between the 1st and 2nd
"+", like this: "i+ ++j".
No, "i +++j" is still tokenized as "i", "++", "+", "j".
This has nothing to do with operator precedence.
To force the parser to recognize (++j), you need to put a space between the 1st and 2nd
"+", like this: "i+ ++j".
m*e
22 楼
Wow...
I think it's good to know stuff, but this is very close to useless knowledge
to me.
the 1st and 2nd
【在 l***8 的大作中提到】
: >> how about i +++j
: No, "i +++j" is still tokenized as "i", "++", "+", "j".
: This has nothing to do with operator precedence.
: To force the parser to recognize (++j), you need to put a space between the 1st and 2nd
: "+", like this: "i+ ++j".
I think it's good to know stuff, but this is very close to useless knowledge
to me.
the 1st and 2nd
【在 l***8 的大作中提到】
: >> how about i +++j
: No, "i +++j" is still tokenized as "i", "++", "+", "j".
: This has nothing to do with operator precedence.
: To force the parser to recognize (++j), you need to put a space between the 1st and 2nd
: "+", like this: "i+ ++j".
l*8
23 楼
You probably will never care about this problem unless your job is to write
a compiler... So yes, it is 99.9% useless.
a compiler... So yes, it is 99.9% useless.
d*n
26 楼
who will actually write this?
maybe some tester?
maybe some tester?
相关阅读
编程方面的语音书网站ios 上面的广告 iAd 的 问题Graph database 业界用的多吗? (转载)为什么好多ID 见到 c++就好象 不共戴天呢?求scala入门请问大牛做科学计算用什么语言合适?如何从另一个IP访问自己的MySQL Server数据库?看不下去了,來說幾句PayPal and Netflix cozy up to Node.jsINTEGER搜索求建议Critical GnuTLS crypto bug leaves Linux, hundreds of apps用python测webpage写脚本真麻烦看了公司的offer,关于业余项目,的确完全属于公司新手问一下iphone/ipad的app用什么写的怎么发布?赵策,速度学erlangData Engineer Summer Intern at NEC Labs America, Princeton什么叫C++ Framework Development如何反编译.so类库?感觉Cassandra比HBase好用很多呀