Can Q_GLOBAL_STATIC replace KStaticDelete ?
michael.pyne at kdemail.net
Tue Jan 23 00:52:59 GMT 2007
On Monday 22 January 2007 18:39, Alexander Neundorf wrote:
> On Tuesday 23 January 2007 00:29, Thiago Macieira wrote:
> > Thiago Macieira wrote:
> > >>+static bool _k_static_##NAME##_destroyed = false;
> > >
> > >Don't initialise the variable. This saves us 4 bytes in the executable.
> > Forget what I said above. The compiler is smart enough to know that
> > initialising to 0 is the same as placing on the .bss. So, by all means,
> > initialise it.
> Sure ? I didn't know that. All versions of gcc ? In all optimization levels
> ? For variables of which types ?
I don't know the answers to any of those questions but I don't think it really
I'd rather be safe and initialize a value and perhaps take a 4 byte hit rather
than leave it uninitialized and rig it so that the value is initialized
before it is used. (Either by some sort of init function or maybe a compiler
flag to force into .bss?)
- Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 191 bytes
Desc: not available
More information about the kde-core-devel