开发者

Simple parsing question [duplicate]

开发者 https://www.devze.com 2023-01-29 18:10 出处:网络
This question already has answers here: Closed 1开发者_StackOverflow2 years ago. Possible Duplicate:
This question already has answers here: Closed 1开发者_StackOverflow2 years ago.

Possible Duplicate:

Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc…)

Undefined Behavior and Sequence Points (C++ FAQ entry)

In C and C++ how is the expression x+++++y parsed? As x++ ++ +y or as x++ + ++y ?


x+++++y is parsed as x ++ ++ + y and not as x ++ + ++ y. According to Maximal Munch principle "the tokenizer should keep reading characters from the source file until adding one more character causes the current token to stop making sense"

x++ ++ +y should not compile(In C and C++) because the post-increment operator ++ requires an lvalue as an argument and returns an rvalue.

0

精彩评论

暂无评论...
验证码 换一张
取 消