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?
相关阅读
谁能讲讲sbt?如果一个service整天挂,怎么解决?有人用IBM的BlueMIX吗?How does Garbage Collection in Java work?半导体公司码农苦逼啊Redis和Memcached有什么区别?求Big Data Principles and best practices of scalable realti (转载)最近这么多讨论startup的,我简单谈两句。。。 (转载)Ro Khanna: 何方妖精,吃老孙一棒! (转载)为什么Cache LRU多用doubly linked list而不是single linked list来实现呢?wordpress, bootstrap, angularjs,学哪个?web services和POST 到url有啥区别?准备追随小赵哥哥的嘱托再给大家出道题求教char**&与char*的不同有做Image mining的吗 (转载)Python里边file writer的问题有人做过把pinterest integrate到自己网站么卡珊爪 怎么学面试题