[Development] Is Qt allowed caching the home dir path?
olivier at woboq.com
Sun Oct 27 17:13:37 CET 2013
On Sunday 27 October 2013 04:53:41 Jiergir Ogoerg wrote:
> It looks like only the home and temp dir paths are worth caching, their
> window$ implementation is ~ 30-40 lines of code
> if counting QDir's subcalls to QFileSystemEngine.
> For these two QDir functions to stay one liners and lock-less (while thread
> safe), I'm caching the paths in QDirPrivate
> (QTSRC/qtbase/src/corelib/io/qdir_p.h and
Don't use global static QStrings. (they have a constructor that is run at load
time of the library, we don't allow that within Qt)
Use the Q_GLOBAL_STATIC macro.
Something like this:
Q_GLOBAL_STATIC_WITH_ARGS(QString, homePath, (QFileSystemEngine::homePath()));
Woboq - Qt services and support - http://woboq.com - http://code.woboq.org
More information about the Development