TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jasen Betts
from: Darin McBride
date: 2004-04-21 11:26:24
subject: Squares

Hello Jasen!

Replying to a message of Jasen Betts to Darin McBride:

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

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

 DM>> The while statement will always increment s such that it points to
 DM>> the character after the nul, which means it's pointing to space
 DM>> that's either unallocated (the one byte after allocated memory is
 DM>> allowed to be pointed at, but not dereferenced, unlike the byte
 DM>> before allocated memory), or at least garbage

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

I saw that when I responded to you ... but then missed it when responding
to Neil.  That even further proves the point - don't play fancy ;-)

Darin

---
* Origin: Tanktalus' Tower BBS (1:250/102)
SEEN-BY: 633/267 270
@PATH: 250/102 99 10/345 229/1000 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™.