Beware to certain "sensible attribution", because are often sources of false mith, due to lack of context.
The OP tagged the message both C and C++.
Now, K&R can be semi-gods about C history, but certainly cannot be considered authority about C++.
Furthermore, compiler optimization can play a fundamental role in C++, but is often viewed as "abusive" from C system programmers (they like to see C as "Assembler with expressions", rather than a "high level language").
Todays compilers will produce much likely exactly the same code (this can be easily proven), and the use of one or the other is much more a matter of taste, then other.
In this sense, I tend to favor for(;;)
because I can easily read it as "for-ever" while while(true)
read as "while this true thing is true", making you to figure how if it can even be false ... . 2 msecs of brain wasted! (But it's a personal opinion: I know many people that has to think more about for(;;)
than while(true)
)
However, I can also recognize both of them as "pictorial representation" (without actually read the text, just looking how they look via photographic memory) pointing to a same intellectual concept (stay here until someone will kick you away from the inside).
About the MS warning, sometime it saves you from bad-written expressions (like true||a
). But is clearly abused, and should not appear, for trivial expressions with no operation inside. Nerveless, MS compiler produce the same machine code in both the cases. May be feedbacks to MS will make them less tedious about that warning on future releases.