TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: JOHN GUILLORY
from: Darin McBride
date: 2004-04-29 15:57:42
subject: Merits

Hello JOHN!

Replying to a message of JOHN GUILLORY to BILL BIRRELL:

 JG> ->     You were implying that a for(;;) loop is inherently clearer
 JG> than a while() -> loop. Without elision that is simply not true.   
 JG> And just how is a for loop clearer?  By the fact alone that    a for
 JG> loop somewhat "hides" the increment portion of the loop, 
  one does
 JG> not realize as easily what is going on, and therefore   
 JG> automatically fogs things up....

???

Sorry, John, but you lost me there.

for (s = blah; *s; ++s)
{
  /* 10 pages of code */
}

is supposedly worse than

while (*s)
{
  /* 5 pages of code */
  putc(*s++, stdout);
  /* 5 more pages of code */
}

Not in my lifetime it isn't!

 JG> ->     Your preferences aside, Darin, you didn't answer the question.
 JG> Pre and -> post-increments behave differently, and you cannot always
 JG> use just one or the -> other without risking gross obfuscation.   
 JG> Just as a programmer will tend to understand either WHILE or UNTIL
 JG> easier and will write their code using either of the two most often,
 JG> so will a programmer tend to use one of the two most often, and will
 JG> generally setup any loops automatically thinking with the method they
 JG> prefer....

Quite true.

Darin

---
* Origin: Tanktalus' Tower BBS (1:250/102)
SEEN-BY: 633/267 270
@PATH: 250/102 99 10/345 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.