This is the mail archive of the gcc-patches@gcc.gnu.org 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


> To be frank, I think this particular point of style is so unimportant as 
> not to be worth standardizing. :-)  

Despite my strong feelings in favor of standardization, I'm inclined to
agree with you in this particular case.

> That said, I'd be perfectly happy with your suggested form, and I'd
> encourage others to weigh in on the issue of whether or not to
> standardize on anything, rather than quibbling over which form is
> best, which seems far too bikeshedish. :-)

It seems hard to me to argue in favor or against making the change without at
least some discussion of what to change it *to* since it would be much harder
to support the position of making the change without arguing a benefit from
one particular style.

However, I reject any style argument based on how easy it is to *write*
something: in my mind, the argument for a consistent style is to make it
easier to *read* the code, so that somebody who's familiar with the style
used in GCC can most easily see "at a glance" what's going on.

My view has always been that the form involving less lines is always best
(all else being equal: I'd ever use that to justify removing blank lines!)
since it enables more of the code to be displayed in a given screen area,
thus providing a larger context.  This argues against any of the multi-line
forms.

However, I think it's almost impossible to provide an argument among "while
(1)", "while (true)", "for (;;)", and "for (; ;)" as to which one's better
since all of them (except perhaps the second), to me, instantly say "infinite
loop" and all occupy one line.  To me, those are the important criteria.

I would be in favor of designating one of those as the preferred style to be
used in the future and making a change to replace any of the forms other than
those four (of which there are likely very few) with the preferred form, but
agree with you that changes between those four forms are more distruptive
than worthwhile.


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