[asterisk-dev] code-cleanup concerns

Mark Sirota msirota at isc.upenn.edu
Fri Apr 14 19:28:24 MST 2006


--On Friday, April 14, 2006 4:28 PM -0700 Brian Degenhardt 
<bmd at bmdhacks.com> wrote:
> Unless somebody can explain why for(;;) is inferior to do{}while(1), or
> why removing curly braces on one-line if statements is worth the
> trouble of patch maintainers everywhere, I think this just does more
> harm than good.

Just FYI, from a 25-year C programming veteran: for (;;) is a more
efficient loop than while (1) for some compilers, because there is no
comparison to zero required.  In modern reality most optimizers will make
them identical, but it is conceivable that there might still be a system
around that treats these literally.  In any case, it's certainly clear to
me that either of them is far more readable than do {} while (1)!

I also think extraneous curly braces are annoying, but I can appreciate
both points of view on this one.

Whether readability patches do more harm than good I'll leave up to you,
but I'm a BIG fan of consistency and readability.  Okay, back to lurking.

Mark
-- 
Mark Sirota, Associate Director, Network Engineering and Services
University of Pennsylvania, Information Systems and Computing
msirota at isc.upenn.edu, 215/573-7214



More information about the asterisk-dev mailing list