Uninitialized static int counters?

Jerry Feldman gaf at blu.org
Fri Feb 6 14:22:59 EST 2009


On 02/06/2009 02:14 PM, pds wrote:
> Its to prevent messages from filling the syslog and causing the
> filesystem to be full of the errors due to a bad ioctl.  I never like
> to assume a variable to be initialized to 0 as in count.  If
> the count wraps the message is repeated another 20 times which isn't
> that bad as the program making that many bad ioctl calls over & over
> again. I would think that there would be other problems if it happens.
>   
I would agree that it is always a good practice to explicitly initialize 
variables, but the C and C++ standards do mandate that variables with 
static storage class are initialized. But, I have seen many people 
bitten in the ass because they assumed something like this.

-- 
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB  CA3B 4607 4319 537C 5846


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20090206/6abf3657/attachment.bin 


More information about the gnhlug-discuss mailing list