unitialized variables

From: Evgeny Kotsuba <evgen@dont-contact.us>
Date: Sat, 27 Apr 2002 11:42:29 +0300

Hi,
>> CVS\squid\lib\radix.c

>> Should be changed to
>> static char *addmask_key =NULL;
>> [...]
>> static char *rn_zeros = NULL, *rn_ones = NULL;
>Are you sure on this? These variables have file scope, not local scope.
But I
>do seem to remember that in the old days before virtual memory there
was
>memory management systems not initializing uninitialized globals to
zero..
First, it is bad style programming as for C as for C++, second we don't
know what will be in future and I don't know details on non-intel
platphorms, and last, the high level optimization with moving all as
possible to registers don't know about memory allocating/commiting.

There is one more on uzing of uninitialized variables:

squid\src\comm_select.c -> comm_select(int msec)

comm_select(int msec)
{
[...]
    fd_set pendingfds;
[..]
/******************
* What about FD_ZERO(&pendingfds); here ?
*****************/
 pending = 0;

 for (j = 0; j < maxindex; j++) {
{
[..]
    if (FD_ISSET(fd, &readfds) && fd_table[fd].flags.read_pending) {
         FD_SET(fd, &pendingfds);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        pending++;
    }
}

SY,
EK
Received on Sat Apr 27 2002 - 02:18:00 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:15:22 MST