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

Thiago Macieira thiago at kde.org
Fri Dec 5 12:08:28 GMT 2008


On Friday 05 December 2008 12:18:22 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*.

While that's not a guarantee from the standard, it is the case in all 
platforms we support.

> Moreover, a high-quality implementation of fill_n will expand above
> special case into memset anyway.

I've seen a lot of non-high-quality STL...

> Add to it that performance is absolutely not an issue in the given
> use-case, I'd aim for a correct solution anytime (be it fill_n() or an
> explicit loop).

Then to be sure, simply loop and assign. The compiler should do a good job. I 
remember reading somewhere that, sometimes, a self-written strlen/strchr is 
faster than the actual functions (a loop written in C, not assembly).

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Software Engineer - Nokia, Qt Software
  Qt Software is hiring - ask me
      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/efbf7b17/attachment.sig>


More information about the kde-core-devel mailing list