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

Thiago Macieira thiago at kde.org
Fri Dec 5 22:42:55 GMT 2008


Matthew Woehlke wrote:
>Johannes Sixt wrote:
>> Wait a second. Where is it written that the null pointer has the same
>> bit pattern as sizeof(pointer) consecutive unsigned chars with value
>> '\0'? Hm? memset is *wrong*.
>
>In that sense, so is using 'if (foo)' versus 'if (foo != null)', yes?
>NULL != 0 would probably break quite a lot of code :-).
>
>(And... that said, I'm actually not sure that NULL == 0 *isn't* codified
>somewhere.)

No, that's not the same thing.

if (foo) means "foo" gets converted to bool and is the same operation as 
"if (foo != 0)". Also NULL == 0 by definition, though C++0x is introducing 
a concept of nullptr which is 0, but not an integer or boolean zero.

The point is:

	void * foo = 0;
isn't necessarily the same as:

	void * foo;
	memset(&foo, 0, sizeof foo);

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081205/79b84021/attachment.sig>


More information about the kde-core-devel mailing list