Currently, there's lots of checking via calls to checkData all over the place, and I wonder if it's possible to remove some of them. Take the following example:
Field3D f, a{0.0}, b{a};
f = (a + 1) * b;
There are seven calls to checkData(Field3D) (one in the copy ctor for b, two in the addition, three in the multiplication, one in the assignment) and two to checkData(BoutReal) (one in the initialisation of a, one in addition).
I would like to remove the checkData(Field3D) from the copy-constructor and -assignment operator. This would allow e.g. making them both noexcept. We've got much better at pre- and post-conditions in Field operations so I think it would be ok to relax them in copy construction/assignment.
A potential downside would be not catching the following situations:
Field3D a, b{a};
// or
void foo(Field3D f);
Field3D c;
foo(c);
I think the first case is probably too rare to worry about and would be caught as soon you tried to use b.
The second case is likely also very rare -- we normally don't pass Fields by value, and this could be solved by calling checkData(f) immediately inside foo anyway (which we should be doing!).
See e.g. #914 for a related issue.
Currently, there's lots of checking via calls to
checkDataall over the place, and I wonder if it's possible to remove some of them. Take the following example:Field3D f, a{0.0}, b{a}; f = (a + 1) * b;There are seven calls to
checkData(Field3D)(one in the copy ctor forb, two in the addition, three in the multiplication, one in the assignment) and two tocheckData(BoutReal)(one in the initialisation ofa, one in addition).I would like to remove the
checkData(Field3D)from the copy-constructor and -assignment operator. This would allow e.g. making them bothnoexcept. We've got much better at pre- and post-conditions in Field operations so I think it would be ok to relax them in copy construction/assignment.A potential downside would be not catching the following situations:
Field3D a, b{a}; // or void foo(Field3D f); Field3D c; foo(c);I think the first case is probably too rare to worry about and would be caught as soon you tried to use
b.The second case is likely also very rare -- we normally don't pass Fields by value, and this could be solved by calling
checkData(f)immediately insidefooanyway (which we should be doing!).See e.g. #914 for a related issue.