问题描述:

In C, what is the default behaviour for expression a=b+++c?

What are other prefix and postfix operators which causes similar challenges for compiler?

网友答案:

C11 draft specification, section 6.4, paragraph 4:

If the input stream has been parsed into preprocessing tokens up to a given character, the next preprocessing token is the longest sequence of characters that could constitute a preprocessing token.

And the example from paragraph 6:

The program fragment x+++++y is parsed as x ++ ++ + y, which violates a constraint on increment operators, even though the parse x ++ + ++ y might yield a correct expression.

So as @EugeneSh. pointed out, there is no challenge for the compiler, it's only a challenge for the reader.

相关阅读:
Top