Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

will be initialized after [-Wreorder] [closed]

Tags:

c++

g++

When I compile my files I get this warning :

In file included from AsyncSQL.cpp:8:0: AsyncSQL.h: In constructor 'CAsyncSQL::CAsyncSQL()': AsyncSQL.h:192:10: warning: 'CAsyncSQL::m_iCopiedQuery' will be initialized after [-Wreorder]    int    m_iCopiedQuery;       ^ 

Here is my AsyngSQL.H http://pastebin.com/u72kyuq7 So what am I doing wrong?

like image 916
Irinel Iovan Avatar asked May 21 '15 04:05

Irinel Iovan


1 Answers

The problem is the order in which you initialize members in the initializer list on line 22,

_SQLResult(): pSQLResult(NULL), uiNumRows(0),               uiAffectedRows(0), uiInsertID(0) 

These should appear in the same order as they appear in the class definition. For example:

class test {   test(): foo(1), bar(2) { }   int  foo;   long bar; }; 
like image 95
SU3 Avatar answered Sep 22 '22 23:09

SU3