On Fri, 8 Jan 2021 at 07:39, Bernhard Lindner <priv...@bernhard-lindner.de> wrote: > > Hi! > > Can someone tell me why QCoreApplication uses an 'int &argc' type parameter > instead of a > plain 'int argc'? Does QCoreApplication expect the value to change? Does it > change the > value by itself? > > When deriving from QCoreApplication this can cause funny crashes if one > forgets to use a > reference type in the derived class' constructor parameter. So I guess there > must be a > very good reason why QCoreApplication uses a reference instead of > copy-by-value.
According to the documentation (https://doc.qt.io/qt-5/qapplication.html#QApplication and https://doc.qt.io/qt-5/qcoreapplication.html#QCoreApplication ): * Note: argc and argv might be changed as Qt removes command line arguments that it recognizes. * Warning: The data referred to by argc and argv must stay valid for the entire lifetime of the QCoreApplication object. > -- > Best Regards, > Bernhard Lindner Regards, Sze-Howe _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest