John E. Malmberg
2004-Nov-28 01:51 UTC
Uninitialized static structure in generator.c/write_sum_head
In the module generator.c, there is a static struct sum_struct null_sum that is not initialized by any way that I can determine in the routine write_sum_head. Shouldn't it more correctly be: const struct sum_struct null_num = {0, 0, 0, 0, 0, NULL}; This would also allow the declaration for the write_sum_head routine to be as below, since the data that sum is pointing to is never modified. void write_sum_head(int f, const struct sum_struct * sum) -John wb8tyw@qsl.net Personal Opinion Only
Paul Slootman
2004-Nov-28 11:10 UTC
Uninitialized static structure in generator.c/write_sum_head
On Sat 27 Nov 2004, John E. Malmberg wrote:> In the module generator.c, there is a static struct sum_struct null_sum > that is not initialized by any way that I can determine in the routine > write_sum_head.A static data structure is guaranteed to be initialised to zero...> 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. Paul Slootman