Re: [PATCH] libxtables: Dont initialize global xt_params

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday, 16. February 2009 11:38:49 you wrote:
> >> Well, I guess that's a job for the compiler/optimizer. I did a quick
> >> test by writing two versions of a small program initializing a static
> >> variable with zero and one version that doesn't (=zeroed in .bss). Guess
> >> what, the size of the resulting executable stays the same.
> >>
> >> When I initialize the variable with a non-zero value, then the program
> >> size increases. I tested "-O2", "-O0" and "-Os" and the results where
> >> the same. Feel free to look at the assembler output, though I guess this
> >> optimization is not measurable and makes the code harder to read :o)
> >
> > For gcc, this depends on the -fno-zero-initialized-in-bss option.
> > Recommendations to avoid zero initialization generally come from
> > a time when gcc didn't do this by default.  Now it is more just
> > personal preference.
>
> I think the 3.x versions don't do this by default, so as long as they're
> supported by the kernel, we should expect people to use them and not
> assume defaults of later versions.

Thanks for clearing this up, Philip and Patrick.

So we've got so far:

1. Better readbility by writing "xyz = NULL;"
2. Correct and a tiny bit larger code using gcc 3
3. Correct and compact code using gcc 4 (released April 2005).

I guess the assembler code generated from gcc 3 <-> gcc 4
will have other performance/size differences,
but it's Patrick's final decision what to do :-)

Cheers,
Thomas

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux