/ kufa Hello, I am wondering of the validity of those lines, not meaning i''m usingthem, but i cant point out in the norm if they are legal, and in such acase the expected behaviour. int a = 2;int b = (++a) * ((++a)+2);printf( "%d %d", ++b, ++b );They compiled in Commeau, but that doesn''t mean it''s legal :)Any help or suggestion is welcome!Thanks, /kufa 推荐答案 1月16日下午1:25,Kufa < pota ... @ gmail.comwrote: On Jan 16, 1:25 pm, "Kufa" <[email protected]: 您好, 我想知道这些行的有效性,并不意味着我正在使用 他们,但我不能指出它们是否合法,并且在这样的情况下是预期的行为。 int a = 2; int b =(++ a)*((++ a)+2); printf("%d%d",++ b,++ b); 他们在Commeau编译,但这并不意味着它是合法的:) 欢迎任何帮助或建议! Hello,I am wondering of the validity of those lines, not meaning i''m usingthem, but i cant point out in the norm if they are legal, and in such acase the expected behaviour.int a = 2;int b = (++a) * ((++a)+2);printf( "%d %d", ++b, ++b );They compiled in Commeau, but that doesn''t mean it''s legal :)Any help or suggestion is welcome! 不,他们不合法。如果有疑问,只需尝试评估你脑海中的表达式 。请记住,没有任何规则可以说只是 因为A在B之前出现在表达式A中将首先进行评估。 - Erik Wikstr?m No, they are not legal. If in doubt just try to evaluate the expressionin your head. Remember that there are no rules that say the justbecause A comes before B in an expression A will be evaluated first. --Erik Wikstr?m Kufa写道: Kufa wrote: 我想知道这些线的有效性,并不意味着我使用它们,但我不能指出它们是否合法,并且在这样的情况下,b / b 预期的行为。 int a = 2; int b =(++ a)*((++ a)+2); printf("%d%d",++ b,++ b); I am wondering of the validity of those lines, not meaning i''m usingthem, but i cant point out in the norm if they are legal, and in such acase the expected behaviour.int a = 2;int b = (++a) * ((++a)+2);printf( "%d %d", ++b, ++b ); 根据标准[5/4]条款,行为未定义。 Best Kai-Uwe Bux The behavior is undefined as per clause [5/4] of the standard.Best Kai-Uwe Bux 不,他们不合法。如果有疑问,只需尝试评估你脑海中的表达式 。请记住,没有规则说明只是 因为A在B之前出现在表达式A中将首先进行评估。 No, they are not legal. If in doubt just try to evaluate the expressionin your head. Remember that there are no rules that say the justbecause A comes before B in an expression A will be evaluated first. 我认为这对于未定义的行为是合法的。你能指出我在某个地方的某些地方会说'它不合法,真的找不到任何东西吗? 谢谢, / kUfa Well i''d think this is legal with undefined behaviour. Can you point mesomewhere in the norm that''d say it''s not legal, really can''t findanything. Thanks, /kUfa 这篇关于几个++运算符在同一行上的有效性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-24 22:37