![](/img/trans.png)
[英]What are the implications for the compiler of using a for loop with ternary statements as conditions?
您可以制作一個使用 boolean 和三元組向前或向后切換的for循環,而不是使用具有相同printf語句的兩個不同循環。 為什么這種形式不好? 因為讀不懂? 無論如何,編譯器會產生兩個不同的循環嗎? 只是好奇這對編譯結果意味着什么。 例子: 代替: 我得到了這個有趣的建議: 使用 Godbolt ...