Skip to content
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

tls: Restructure gnutls_datum move operator, adding construstor #2214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

elcallio
Copy link
Contributor

Refs c224fe0
Refs #2208

Makes the type more RAII complete, and following usual pattern of destroy + construct in place -> old eyes can read easier.

Refs c224fe0
Refs scylladb#2208

Makes the type more RAII complete, and following usual pattern of
destroy + construct in place -> old eyes can read easier.
::gnutls_free(data);
if (this != &other) {
this->~gnutls_datum();
new (this) gnutls_datum(std::move(other));
Copy link
Contributor

@tchaikov tchaikov Apr 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i understand the motivation. but, personally, i am not in favor of calling destructor manually and using placement new unless really necessary. they hurt the readability. and the new move-ctor is never used. i'd defer the review to seastar maintainers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only motivation is that we tend to use this pattern elsewhere in seastar etc. Plus it is delegating operations. :-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see. i just don't really like this pattern, despite that it is repeating itself in seastar =( . and yeah, it reuses the dtor in a very obvious way.. but still.. i just cannot convince myself that i like it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm at fault for introducing it but I now regret it, it's likely not totally safe wrt the standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants