Uninitialized static structure in generator.c/write_sum_head

John E. Malmberg wb8tyw at qsl.net
Sun Nov 28 15:52:03 GMT 2004


Paul Slootman wrote:
> On Sat 27 Nov 2004, John E. Malmberg wrote:
> 
> A static data structure is guaranteed to be initialised to zero...

Ok.

>>Shouldn't it more correctly be:
>>
>>    const struct sum_struct null_num = {0, 0, 0, 0, 0, NULL};
> 
> Perhaps more readable, but in no way more correct.

Putting the const qualifier on that variable allows the const qualifier 
  to be put on the "sum" parameter.

This allows the compiler to better optimize the code for the modules 
that call write_sum_head().

In any case for the purposes of porting RSYNC to Posix Threads means 
that this is not a thread specific variable.

-John
wb8tyw at qsl.net
Personal Opinion Only



More information about the rsync mailing list