TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Bill Birrell
from: Jasen Betts
date: 2004-04-22 18:08:58
subject: Squares

Hi Bill.

22-Apr-04 01:28:01, Bill Birrell wrote to Jasen Betts


  >> Its worse than that, the body of the loop gets a different range
  >> of s values of s too.

 BB> No, Jasen that would only be true of pre-increment which you and
 BB> Darin habitually use. I habitually use post-increment largely
 BB> because I do not habitually use C++

 BB> The while (while(*s++){};) loop evaluates *s, and only if not zero
 BB> increments s - that's what post-increment means.
                                                       ^^^^^^^^^^^^^^^^
no.

the while loop evaluates s++  which is non zero if *s was non zero at the
start of the evaluation, evaluating *s++ always increments s

 BB> On the next iterations it looks at it again until *s=='\0'. Then it
 BB> terminates

 BB> It would make a difference only if the part in braces referenced
 BB> or altered s or *s. It doesn't

In that example it doesn't the original claim had unspecified contents.

 JB>>>>>>>>> for( s=target ; *s ; s++ ) {

 BB>>>>>>> char *s=target; while(*s++) {...};

 -=> Bye <=-

---
* Origin: One less than the checksum of "Jasen Betts" (3:640/1042)
SEEN-BY: 633/267 270
@PATH: 640/1042 531 954 774/605 123/500 106/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™.