TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: ROGER SCUDDER
from: DARIN MCBRIDE
date: 1998-01-10 21:48:00
subject: Pointer To A String

GW>   IMO memset()ing a whole array to '\0' is massive 
GW> overkill, because as
GW> far as 'C' is concerned any characters past the *first* '\0' in a
GW> string do *not* exist.  Even worse, doing this will probably hide a
GW> defect in the logic that you really need to know about and fix.
 RS>  While reading through the source code for MsgEd v2.0 I found
 RS>  this...
 RS> #define clearline(l,c) memset(l,0,c)
 RS>  Seems Jim Nutt conceived of clearing a string the same way I do.
A person can be a "Bad Programmer" and still come out with a good product, 
just as a "Good Programmer" can come out with a poor product.  Business 
measures success in dollars, programmers in elegance.
 RS>  I guess Jim comes under your "Bad Programmers" blanket statement
 RS>  too.  I can tell you one thing for sure.  I'm a lot more comfortable
 RS>  being in the company of bad programmers like Jim Nutt, than in the
I don't feel comfortable being in the company of bad programmers no matter 
what their products.
 RS>  company of anal retentive ones like you.
Roger, flame or not, many consider it flamebait.  I would suggest calming 
down.  I don't recall Gaines calling you names (good or bad), please don't 
start it.
Gaines still has a valid point: clearing out a string to all zero *IS* 
overkill, and serves no real purpose, except to hide bugs.  Sure, the product 
may work - the bugs are hidden! - but often those bugs will creep up one day 
on some unsuspecting customer/client/user, long after support for the product 
has been withdrawn.  This merely damages your reputation, something business 
can't get its head around until it's too late.
There are times when I throw code like that into a product - but only as a 
temporary fix.  As soon as I have time, I track down the original bug, quash 
it, and get rid of the kludge.  The one time I left it in, it managed to bite 
me back only a few months later.  At least the one time I knew about it... 
perhaps a customer will find out one I left next month...
---
---------------
* Origin: Tanktalus' Tower BBS (1:250/102)

SOURCE: echomail via exec-pc

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