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?
相关阅读
请教大家一个directx显卡输出格式的问题.如何修改linux PATH 以便programming?Default function template arguments在带有ajax的页面做screen scrape大家手头都装模作样的放些啥书(纸)double转换int的问题如何在C里面call C++的routine呢大家programming时怎么命名?实时进程间通讯问题C++小插曲how把文件drag到一个application's icon, so it takes the file as input ?Traited Python object attributes -for java peopleDiv+Css做网页 (转载)讲design pattern的哪本书最好?中国首台国产二百万亿次超级计算机正式发布 (转载)Visual C++ 如何高亮显示 括号匹配?什么是win xp 上最好的C programming environment?多谢各位大侠从网站抓内容的软件或程序VNC for multiple users ( >= 2) (转载)