[Patch] Fix undeleted "static QFont *_font" in kglobalsettings.cpp

Johannes Sixt j.sixt at viscovery.net
Tue Dec 9 07:45:31 GMT 2008


Matthew Woehlke schrieb:
> Thiago Macieira wrote:
>> [snip]
>> The point is:
>>
>>     void * foo = 0;
>> isn't necessarily the same as:
>>
>>     void * foo;
>>     memset(&foo, 0, sizeof foo);
> 
> Um... in that case I'm not too horribly worried about platforms with
> extremely esoteric ways of storing integers :-).

No, you are misunderstanding: It's not the integers that are stored in an
esoteric way, but the *null pointer*! There are architectures out there
where the null pointer does not have all bits set to zero. Nevertheless,
in the C++ program code you still write

   Foo* x = 0;

That said, it's unlikely that such a platform is among those supported by
KDE (and perhaps even Qt)...

> I've certainly seen code that assumes a "cleared" block of memory means
> that any of that memory cast as a pointer gives NULL (e.g.
> calloc(sizeof(foo)), where foo is a struct containing pointers).

And this assumption is bad, baaaad, BAAAAD. ;)

-- Hannes




More information about the kde-core-devel mailing list