Bug 29017 - [Qt] Use the declaration order in initializer lists
Summary: [Qt] Use the declaration order in initializer lists
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Minor
Assignee: Nobody
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2009-09-07 12:16 PDT by Laszlo Gombos
Modified: 2009-09-08 10:30 PDT (History)
1 user (show)

See Also:


Attachments
proposed patch (3.26 KB, patch)
2009-09-07 12:21 PDT, Laszlo Gombos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Laszlo Gombos 2009-09-07 12:16:29 PDT
Class members are initialised in the order they are declared, not the order they appear in initialiser lists. It is a good practice to put the elements of the member initialization list in the same order as the data members of the class. This practice seems to be followed WebKit, let's bring this to QtWebKit port as well.

This is sometimes reported as a compiler warning for some compilers (e.g. gcc with high enough warning level).
Comment 1 Laszlo Gombos 2009-09-07 12:21:06 PDT
Created attachment 39160 [details]
proposed patch
Comment 2 Laszlo Gombos 2009-09-07 12:30:26 PDT
gcc warning (with elevated warning level) for reference:

WebCore/platform/graphics/qt/FontCacheQt.cpp: In constructor 'WebCore::FontPlatformDataCacheKey::FontPlatformDataCacheKey(const WebCore::FontDescription&)':
WebCore/platform/graphics/qt/FontCacheQt.cpp:136: warning: 'WebCore::FontPlatformDataCacheKey::m_bold' will be initialized after
WebCore/platform/graphics/qt/FontCacheQt.cpp:135: warning:   'int WebCore::FontPlatformDataCacheKey::m_size'
WebCore/platform/graphics/qt/FontCacheQt.cpp:59: warning:   when initialized here

WebKit/qt/Api/qwebframe_p.h: In constructor 'QWebFramePrivate::QWebFramePrivate()':
WebKit/qt/Api/qwebframe_p.h:90: warning: 'QWebFramePrivate::q' will be initialized after
WebKit/qt/Api/qwebframe_p.h:82: warning:   'Qt::ScrollBarPolicy QWebFramePrivate::horizontalScrollBarPolicy'
WebKit/qt/Api/qwebframe_p.h:63: warning:   when initialized here

WebCore/platform/network/qt/QNetworkReplyHandler.h: In constructor 'WebCore::QNetworkReplyHandler::QNetworkReplyHandler(WebCore::ResourceHandle*, WebCore::QNetworkR
eplyHandler::LoadMode)':
WebCore/platform/network/qt/QNetworkReplyHandler.h:73: warning: 'WebCore::QNetworkReplyHandler::m_resourceHandle' will be initialized after
WebCore/platform/network/qt/QNetworkReplyHandler.h:72: warning:   'QNetworkReply* WebCore::QNetworkReplyHandler::m_reply'
WebCore/platform/network/qt/QNetworkReplyHandler.cpp:132: warning:   when initialized here
Comment 3 Eric Seidel (no email) 2009-09-08 10:30:14 PDT
Comment on attachment 39160 [details]
proposed patch

Clearing flags on attachment: 39160

Committed r48164: <http://trac.webkit.org/changeset/48164>
Comment 4 Eric Seidel (no email) 2009-09-08 10:30:19 PDT
All reviewed patches have been landed.  Closing bug.