-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core] Remove unnecessary new
operators ...
#1313
Conversation
…ed` or `make_unique`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
|
||
/** | ||
* @brief Query if this object is created. | ||
* | ||
* @return true if created, false if not. | ||
**/ | ||
bool IsCreated() { return(created); } | ||
ECAL_API bool IsCreated() { return(created); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'IsCreated' can be made const [readability-make-member-function-const]
ECAL_API bool IsCreated() { return(created); } | |
ECAL_API bool IsCreated() const { return(created); } |
- Respect rule of 5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
ecal/core/include/ecal/ecal_timer.h
Outdated
/** | ||
* @brief Move assignment | ||
**/ | ||
ECAL_API CTimer& operator=(CTimer&& rhs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: move assignment operators should be marked noexcept [performance-noexcept-move-constructor]
ECAL_API CTimer& operator=(CTimer&& rhs); | |
ECAL_API CTimer& operator=(CTimer&& rhs) noexcept ; |
/** | ||
* @brief Move assignment | ||
**/ | ||
ECAL_API CDynamicJSONSubscriber& operator=(CDynamicJSONSubscriber&& rhs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: move assignment operators should be marked noexcept [performance-noexcept-move-constructor]
ECAL_API CDynamicJSONSubscriber& operator=(CDynamicJSONSubscriber&& rhs); | |
ECAL_API CDynamicJSONSubscriber& operator=(CDynamicJSONSubscriber&& rhs) noexcept ; |
CDynamicJSONSubscriber::CDynamicJSONSubscriber(CDynamicJSONSubscriber&& rhs) | ||
= default; | ||
|
||
CDynamicJSONSubscriber& CDynamicJSONSubscriber::operator=(CDynamicJSONSubscriber&& rhs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: move assignment operators should be marked noexcept [performance-noexcept-move-constructor]
ecal/core/src/pubsub/ecal_proto_dyn_json_sub.cpp:215:
- = default;
+ noexcept = default;
We should rather delete the move operator than to just default them, it might lead to problems. |
Ubuntu build fails with:
Need to check if sporadic failure (even though - why?) or reproducible from the changes (though I wouldn't know / understand why...). |
and replace with
make_shared
ormake_unique
.Description
There is really need for explicit use of
new
so replace with creation of shared/unique pointers.Cherry-pick to: