Further to the question about default ctors for such "obvious" stuff as
On 2019-05-21 10:27, Mutz, Marc via Development wrote:
class QRect {
int x, y, w, h;
public:
QRect() = default;
};
QRect r; // partially-formed
r.x(); // compilers _already_ warn about this
QRect r = {}; // zero-initialized
I've been working with Qt for two decades now. Guess what I just wrote
and had to debug?
QSize zero;
Anyone spot the bug? Hint: the following /is/ correct:
QPoint origin;
Now, anyone here who wants to defend that as good API design?
Anyone?
Repeat after me: default ctors do _not_ establish a valid value.
Thanks,
Marc
_______________________________________________
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development