[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
Re: [XaraXtreme-dev] compile failure with recent versions
- From: Vasil Dimov <vd@xxxxxxxxxxx>
- Date: Thu, 20 Apr 2006 09:33:51 +0300
- Subject: Re: [XaraXtreme-dev] compile failure with recent versions
On Tue, Apr 18, 2006 at 02:15:59PM +0100, Alex Bligh wrote:
> Vasil,
>
> >./docmsgs.h: In constructor `DocChangingMsg::DocChangingMsg(Document*,
> >DocChangingMsg::DocState)':
> >./docmsgs.h:163: warning: `DocChangingMsg::pChangingDoc' will be
> >initialized after
> >./docmsgs.h:160: warning: `DocChangingMsg::DocState
> >DocChangingMsg::State'
> >./docmsgs.h:171: warning: when initialized here
> >./docmsgs.h: In constructor `DocChangingMsg::DocChangingMsg(Document*,
> >Document*, DocChangingMsg::DocState)':
> >./docmsgs.h:167: warning: `DocChangingMsg::pNewDoc' will be initialized
> >after
> >./docmsgs.h:160: warning: `DocChangingMsg::DocState
> >DocChangingMsg::State'
> >./docmsgs.h:174: warning: when initialized here
>
> That one is distinctly odd. The warning comes when you do not initialize
> members in the same order as the constructor. I don't see the warnings
> at all. The code is (with comments removed for readability):
>
> Document* pChangingDoc;
> Document* pOldDoc;
> Document* pNewDoc;
> DocState State;
> DocChangingMsg(Document* pdoc, DocState state)
> : pChangingDoc(pdoc), pOldDoc(NULL),
> pNewDoc(NULL), State(state) { /* empty */ }
>
> DocChangingMsg(Document* pThisOldDoc, Document* pThisNewDoc,
> DocState state)
> : pChangingDoc(NULL), pOldDoc(pThisOldDoc),
> pNewDoc(pThisNewDoc), State(state) { /* empty */ }
>
> As far as I can tell, they /are/ in the right order. This looks like
> a compiler problem to me. gcc version?
Well, the code I see in docmsgs.h svn version 843 is a bit different
than the one you pasted above:
DocState State;
Document* pChangingDoc;
Document* pOldDoc;
Document* pNewDoc;
DocChangingMsg(Document* pdoc, DocState state)
: pChangingDoc(pdoc), State(state), pOldDoc(NULL), pNewDoc(NULL) { /* empty */ }
DocChangingMsg(Document* pThisOldDoc, Document* pThisNewDoc, DocState state)
: pOldDoc(pThisOldDoc), pNewDoc(pThisNewDoc), State(state) , pChangingDoc(NULL) { /* empty */ }
This explains why I see the warning and you do not :-)
I would suggest the following patch:
--- docmsgs.h.diff begins here ---
Index: docmsgs.h
===================================================================
--- docmsgs.h (revision 843)
+++ docmsgs.h (working copy)
@@ -168,10 +168,10 @@
// (SELCHANGED only)
DocChangingMsg(Document* pdoc, DocState state)
- : pChangingDoc(pdoc), State(state), pOldDoc(NULL), pNewDoc(NULL) { /* empty */ }
+ : State(state), pChangingDoc(pdoc), pOldDoc(NULL), pNewDoc(NULL) { /* empty */ }
DocChangingMsg(Document* pThisOldDoc, Document* pThisNewDoc, DocState state)
- : pOldDoc(pThisOldDoc), pNewDoc(pThisNewDoc), State(state) , pChangingDoc(NULL) { /* empty */ }
+ : State(state), pChangingDoc(NULL), pOldDoc(pThisOldDoc), pNewDoc(pThisNewDoc) { /* empty */ }
};
--- docmsgs.h.diff ends here ---
--
Vasil Dimov
gro.DSBeerF@dv
Testing can show the presence of bugs, but not their absence.
-- Edsger W. Dijkstra