This is the mail archive of the
mailing list for the GCC project.
Re: [RFC/PATCH] Standardize on "for (;;)" for unbounded loops
- From: Ian Lance Taylor <iant at google dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 30 Oct 2006 06:43:15 -0800
- Subject: Re: [RFC/PATCH] Standardize on "for (;;)" for unbounded loops
- References: <Pine.LNX.firstname.lastname@example.org>
Roger Sayle <email@example.com> 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