[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdepimlibs/akonadi/kmime
From:       Marc Mutz <marc () kdab ! net>
Date:       2008-04-08 5:56:48
Message-ID: 200804080756.49234.marc () kdab ! net
[Download RAW message or body]

On Monday April 7 2008 16:52, Allen Winter wrote:
> --- trunk/KDE/kdepimlibs/akonadi/kmime/messageparts.h #794447:794448
<snip>
> -      static const QLatin1String Envelope;
> +      static const QLatin1String Envelope( "ENVELOPE" );

This is wrong. Even with string folding optimizing away the multiple copies of 
the string data itself, it will still need to allocate a QLatin1String() per 
translation unit, and run a ctor on it (which is problematic, if that ctor 
comes from another library)...

Sounds like a no-no to me. Make them (non-static) inline functions that return 
the string data:
  inline QLatin1String envelope() { return QLatin1String("ENVELOPE"); }

Generally speaking: this violates the "do not use static const <user-defined 
type from other lib> in shared objects" rule. How about a krazy check for 
that one? :)

Thanks,
Marc

-- 
Marc Mutz - marc@kdab.com, mutz@kde.org - Klarälvdalens Datakonsult AB
Platform-independent software solutions - www.kdab.com info@kdab.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic