I don't know how many bytes can you save, any data? Is it guaranteed that uninitialized data field is zero on other platforms?
On Wed, Oct 15, 2008 at 1:22 PM, Blaisorblade <[EMAIL PROTECTED]> wrote: > > Hi all, > I noticed that in some cases you explicitly initialize global > variables to 0 when definining them, like in src/allocation.cc: > int NativeAllocationChecker::allocation_disallowed_ = 0; > > That wastes space in the binary, which would be saved with this simple > change: > > -int NativeAllocationChecker::allocation_disallowed_ = 0; > +int NativeAllocationChecker::allocation_disallowed_; > > In fact, on Linux, assigning 0 causes the variable to be allocated in > the .data section instead of the .bss (blank static storage) section, > which is represented in the binary simply by its size and is cleared > by the program loader before execution. > > Would you accept a patch removing all those occurrences? I know the > saving would be little (I estimate about one 1K, plus maybe a slight > time saving at load time), but such little wastes are forbidden, for > instance, by the coding style of the Linux kernel source tree. > > Regards > > Paolo 'Blaisorblade' Giarrusso > > > --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
