On Fri, 14 Apr 2006 22:28:24 -0400
Mark Sirota <[EMAIL PROTECTED]> wrote:
> --On Friday, April 14, 2006 4:28 PM -0700 Brian Degenhardt
> <[EMAIL PROTECTED]> 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)!
Some compilers print a warning for "while (1)" as this is a constant
expression. This warning is intended to catch typos like "while (v = 1)"
instead of "while (v == 1)".
The construct "for (;;)" does not generate a warning on any compiler I
am aware of.
Craig
-----------------------------------------------------------------------
Craig Southeren Post Increment VoIP Consulting and Software
[EMAIL PROTECTED] www.postincrement.com.au
Phone: +61 243654666 ICQ: #86852844
Fax: +61 243673140 MSN: [EMAIL PROTECTED]
Mobile: +61 417231046
"It takes a man to suffer ignorance and smile.
Be yourself, no matter what they say." Sting
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev