-3
printf("%3o\t%2x\t%3d\t%c\n", c = getchar(), c, c, c);
我得到一个警告,说“无序修改和访问'c'[-Wunsequenced]”。错误很容易修复;我所要做的就是将getchar()
与printf()
分开,但我只想更好地理解该指令为什么会产生警告,以及如果我实际运行它会出现什么问题。这个C函数有什么问题? (printf()with getchar())
这与使用CPP宏实现printf()
的可变长度参数列表有什么关系吗?
可能的重复[为什么这些构造(使用++)未定义的行为?](http://stackoverflow.com/questions/949433/why-are-these-constructs-using-undefined-behavior) – Olaf