On Fri, 26 Feb 2010, Bob Ammerman wrote: > Em 26/2/2010 06:11, Alan B. Pearce escreveu: > >> The 'for' construct is much more concise, elegant > >> and easier to understand. > >> > > ;))) Not according to Chuck Hellebuyuk that wrote "Beginners Guide to > > Embedded C Programming" (available through Microchip). He also doesn't > > like > > the ++ and += styles of notation ... > > > > Some C compilers for small systems do a better job at: > > i = 10; > while ( i != 0) > --i; > > than: > > for (i=0; i < 10; ++i) > ; Granted but a decent compiler can easily inspect the above 'for' loop and replace it with the preceading while 'loop' equivalent. Going the other way would be MUCH harder. So there is an advantage to having a 'for' loop construct in addition to a 'while' loop construct. > > or sometimes even: > > for (i=10; i !=0;--i) > ; There is no excuse for a compiler that generates inferior code in this case. But I ask again specifically why does Chuck Hellebuyuk depricate 'C' 'for' loops? Regards Sergio Masci -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist