I'm confused about some compiler warnings.
-
hi,
my app utilize c & c++ std mixed to Qt c++ .... in some part of my app these generates some warnings do not understand by me..... I have a lot of these because I do a lot of repetitive use of the code structure ... the tree warning:
double MainWindow::kTagx = 0; /*static variable declaration*/ kTagx = ui->le_xoff1->text().toDouble(false); /*variable use*/ /home/Qt/BC/mainwindow.cpp:7434: warning: converting 'false' to pointer type for argument 1 of 'double QString::toDouble(bool*) const' [-Wconversion-null] kTagx = ui->le_xoff1->text().toDouble(false); /*warning*/ ^ *********************************************************************************** std::vector<BoxT> boxt; /*struct vector declaration*/ for ( int ibox = 0; ibox != boxt.size(); ibox++) /*usage vector.size value but c++ */ { ...... /home/Qt/BC/mainwindow.cpp:10035: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for ( int ibox = 0; ibox != boxt.size(); ibox++) /*warning but not in c++*/ ^ ********************************************************************* std::size_t read2; /*declare*/ /home/Qt/BC/bth2.cpp:293: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while ((read2 = getline(&line2, &len2, file2)) != -1) { qDebug() << "nice stupid";} /*usage & warning .... but in c++ no warning*/
I appreciate any suggest (link to study is ok ... an explanation would be an icing on the cake).
regards
Giorgio -
hi,
my app utilize c & c++ std mixed to Qt c++ .... in some part of my app these generates some warnings do not understand by me..... I have a lot of these because I do a lot of repetitive use of the code structure ... the tree warning:
double MainWindow::kTagx = 0; /*static variable declaration*/ kTagx = ui->le_xoff1->text().toDouble(false); /*variable use*/ /home/Qt/BC/mainwindow.cpp:7434: warning: converting 'false' to pointer type for argument 1 of 'double QString::toDouble(bool*) const' [-Wconversion-null] kTagx = ui->le_xoff1->text().toDouble(false); /*warning*/ ^ *********************************************************************************** std::vector<BoxT> boxt; /*struct vector declaration*/ for ( int ibox = 0; ibox != boxt.size(); ibox++) /*usage vector.size value but c++ */ { ...... /home/Qt/BC/mainwindow.cpp:10035: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for ( int ibox = 0; ibox != boxt.size(); ibox++) /*warning but not in c++*/ ^ ********************************************************************* std::size_t read2; /*declare*/ /home/Qt/BC/bth2.cpp:293: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while ((read2 = getline(&line2, &len2, file2)) != -1) { qDebug() << "nice stupid";} /*usage & warning .... but in c++ no warning*/
I appreciate any suggest (link to study is ok ... an explanation would be an icing on the cake).
regards
Giorgio@gfxx said in std c++ and QT some warning ...:
Hi
-
converting 'false' to pointer type for argument 1 of 'double QString::toDouble(bool*)
It expects a pointer type and tells you that false is not such type. C++ is not as relaxed as c with types.
try NULL or nullptr
http://en.cppreference.com/w/cpp/types/nullptr_t
Its asks for a pointer to a bool so it can return convert status there.
false is not a null pointer.
Maybe you can even just leave it out. -
comparison between signed and unsigned integer expressions [-Wsign-compare]
I think its covered good here
http://stackoverflow.com/questions/7984955/what-is-wrong-with-my-for-loops-i-get-warnings-comparison-between-signed-and-u
-