This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC/PATCH] Standardize on "for (;;)" for unbounded loops

Roger Sayle <> writes:

> Now that we're back in stage 1, I'd like to (re)propose the following
> minor tweak to GCC's coding style.  There are several different ways
> of expressing infinite/unbounded loops in C, including the following:

> Indeed, all of these forms are currently found in GCC's source code.
> I'd like to suggest as an extension to our current style guidelines,
> that we select one of the above as the preferred form, and recommend
> its use in new contributions.

Personally I see no benefit to standardizing this.

As far as I am concerned, the goal of this sort of standardization is
always and only to make the code easier to read.  I do believe
strongly that mandating particular spacing conventions makes the code
easier to read.  But I think that "while (true)" and "while (1)" and
"for (;;)" are equally easy to read (I have no idea why any code would
use "do ... while (1);"; that seems clearly harder to read, and I
think those uses should be changed).

If we do want to standardize on one of these choices, then I think we
should standardize on the one which is used most often in the existing
code base.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]