Enforce rule of three or rule of five for future ESBMC extensions? #603
Replies: 3 comments 3 replies
-
Is there any static analysis tool that can help us to ensure this rule? |
Beta Was this translation helpful? Give feedback.
-
Yes. Yes. I agree with these suggestions :-) |
Beta Was this translation helpful? Give feedback.
-
Definitely yes!
Can you elaborate how adding defaulted constructors/operators help in that regard? Deleted ones and defaulted copy when move is defined, sure, because they are required for the correct behaviour. But for example struct A {
A(const A &) = default;
A(A &&) = default;
A & operator=(const A &) = default;
A & operator=(A &&) = default;
}; seems pointless. |
Beta Was this translation helpful? Give feedback.
-
Shall we enforce the C++ rule of three for future ESBMC development? If smart pointers are used, perhaps escalate it to rule of five?
And explicitly add default/delete copy constructors and copy assignment operators in the class, so that the compiler would report error when a shallow copy is about to happen in the code changes. This would save us lots of debugging time, and prevent unexpected failure due to shallow copy.
Beta Was this translation helpful? Give feedback.
All reactions