Error in published patch to smbd/filename.c
rabollinger at home.com
Mon Nov 27 15:16:59 GMT 2000
Sorry your trouble... After attempting to reproduce the original error it
mysteriously went away. My favorite theory is that the sole effect of
making the variable explicitly initialized to zero was to _move_ it out of
harm's way from a different problem which had been corrected in the mean
time by other changes. Never mind.
----- Original Message -----
From: "Andrew Tridgell" <tridge at linuxcare.com>
To: <jeremy at valinux.com>
Cc: <rabollinger at home.com>; <samba-technical at us5.samba.org>; <jra at samba.org>
Sent: Monday, November 27, 2000 7:32 AM
Subject: Re: Error in published patch to smbd/filename.c
> > Actually, I don't think it matters as anything defined as
> > static and not initialized is automatically put into the BSS
> > segment, which is implicitly zero.
> > Your patch does make the intent clearer though, thanks.
> nope, the patch is wrong.
> The reason you should NOT initialise static variables that you want to
> start as zero is that it makes the binaries larger and slower to
> load. Try running "size" on binaries with and without initialisation
> and compare the size of the resulting binaries. Think about where the
> initial values of the variables come from in the two cases. We should
> put variables in the bss whenever possible to try to lower the
> resources required by Samba.
> btw, I have often heard misguided individuals say that you can't rely
> on static variables starting as zero. That is rubbish. The behaviour
> is defined by the C standard and is OK to rely on. I have seen one
> system where it was broken (a weird parallel OS called CellOS that I
> worked on a while back) but the correct fix was to the badly broken OS
> kernel, not to the programs running on it.
More information about the samba-technical