TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Bill Birrell
from: Darin McBride
date: 2004-04-22 18:24:40
subject: Squares

Hello Bill!

Replying to a message of Bill Birrell 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

Nope ;-)

 BB> Darin habitually use. I habitually use post-increment largely because
 BB> I do not habitually use C++.

Fair enough.

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

Nope.

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

Yup.

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

The loop usually does reference *s - strlen is about the only thing that
doesn't reference *s.  Since not referencing *s is so rare, I think it's a
better idea to assume the loop will reference it when talking about
generics like this.

 BB>     If you don't believe me, look at it in debug.

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™.