1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-27 01:55:32 +03:00

CODING_STYLE: say that "for (;;)" is better than "while (1)"

This commit is contained in:
Lennart Poettering 2015-07-31 20:00:07 +02:00
parent 65c85ef511
commit cad6982291

View File

@ -314,3 +314,10 @@
are always defined after more global ones. Thus, our local are always defined after more global ones. Thus, our local
definitions will never "leak" into the global header files, possibly definitions will never "leak" into the global header files, possibly
altering their effect due to #ifdeffery. altering their effect due to #ifdeffery.
- To implement an endless loop, use "for (;;)" rather than "while
(1)". The latter is a bit ugly anyway, since you probably really
meant "while (true)"... To avoid the discussion what the right
always-true expression for an infinite while() loop is our
recommendation is to simply write it without any such expression by
using "for (;;)".