Bug #1729
Size by default should be empty
Status: | Rejected | Start date: | 05/24/2017 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | Zbigniew Rebacz | % Done: | 0% | |
Category: | Core | Spent time: | - | |
Target version: | Release 2017.2 |
Description
I see that by default we don't initialize size value to (0, 0):
Size_() {} Size_(T cx, T cy) : cx(cx), cy(cy) {}
I believe the first constructor should look like this
Size_() : cx(static_cat<T>(0), static_cast<T>(0)) {} Size_(T cx, T cy) : cx(cx), cy(cy) {}
And what I need is to make sure that:
Size size; if (size.IsEmpty()) { // Should be empty by default. }
History
#1 Updated by Miroslav Fidler almost 8 years ago
Well, this is how it is designed. Same thing is true for 'int' or 'double'. These classes are meant to be the same.
It even have some perfomance impacts, albeit small, e.g.
Size x1000;
is slower when default constructor does something.
#2 Updated by Miroslav Fidler almost 8 years ago
- Assignee changed from Miroslav Fidler to Zbigniew Rebacz
#3 Updated by Zbigniew Rebacz almost 8 years ago
- Status changed from New to Rejected
OK - I will reject this issue. For the next time I will need to remember that by defaults it initialized with random values.