Closed tormodvolden closed 3 years ago
With this it compiles without any warnings here (gcc 9.3.0).
In file included from flashingthread.cpp:1: flashingthread.h: In constructor ‘FlashingThread::FlashingThread(QObject, bool, QString, bool)’: flashingthread.h:18:13: warning: ‘FlashingThread::firmwarePath’ will be initialized after [-Wreorder] 18 | QString firmwarePath; | ^~~~ flashingthread.h:17:10: warning: ‘bool FlashingThread::massErase’ [-Wreorder] 17 | bool massErase; | ^~~~~ flashingthread.h:10:5: warning: when initialized here [-Wreorder] 10 | FlashingThread(QObject parent = nullptr, bool driverMissing = false, QString firmwarePath = "", bool massErase = false) | ^~~~~~
From Stroustrup via https://stackoverflow.com/a/14910427 : "The constructors are called in the order in which they are declared in the class rather than the order in which they appear in the initializer list."
With this it compiles without any warnings here (gcc 9.3.0).
In file included from flashingthread.cpp:1: flashingthread.h: In constructor ‘FlashingThread::FlashingThread(QObject, bool, QString, bool)’: flashingthread.h:18:13: warning: ‘FlashingThread::firmwarePath’ will be initialized after [-Wreorder] 18 | QString firmwarePath; | ^
~~~ flashingthread.h:17:10: warning: ‘bool FlashingThread::massErase’ [-Wreorder] 17 | bool massErase; | ^~~~~ flashingthread.h:10:5: warning: when initialized here [-Wreorder] 10 | FlashingThread(QObject parent = nullptr, bool driverMissing = false, QString firmwarePath = "", bool massErase = false) | ^~~~~~