[Xcb] [PATCH] Initialize all fields of addrinfo and use #ifdef
Barton C Massey
bart at cs.pdx.edu
Thu Aug 28 21:37:25 PDT 2008
In message <20080828114713.GC24980 at abydos.adm.naquadah.org> you wrote:
> At 1219854880 time_t, Barton C Massey wrote:
> > The memset() here seems like it could potentially mask a
> > bug. Initializing unknown extra fields to zero seems
> > scary---better to leave them uninitialized and hope the
> > compiler or valgrind can notice and warn. Am I missing
> > something?
>
> I agree, but there _is_ a warning from the compiler.
> So if initializing to 0 is wrong, what are the good values?
>
> I let you think about this. ;-)
> Meanwhile, I postpone this patch.
:-) The point is, if the compiler is complaining about some
particular uninited field of a struct, initialize that field
to an appropriate value. The problem with the memset() is
that if new fields are added, they will be silently
initialized to 0. Unless I missed something...
Bart
More information about the Xcb
mailing list