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

fix: build break in search_family #4008

Merged
merged 1 commit into from
Oct 28, 2024
Merged

fix: build break in search_family #4008

merged 1 commit into from
Oct 28, 2024

Conversation

romange
Copy link
Collaborator

@romange romange commented Oct 28, 2024

Also perform additional clean-up of cntx->reply_builder() - Part11

Also perform additional clean-up of cntx->reply_builder() - Part11

Signed-off-by: Roman Gershman <[email protected]>
@@ -1152,7 +1151,7 @@ void SDiff(CmdArgList args, Transaction* tx, SinkReplyBuilder* builder, Connecti

tx->ScheduleSingleHop(std::move(cb));
ResultSetView rsv = DiffResultVec(result_set, src_shard);
SetReplies{cntx}.Send(rsv);
SetReplies{builder, bool(cntx->conn_state.script_info)}.Send(rsv);
Copy link
Contributor

@BagritsevichStepan BagritsevichStepan Oct 28, 2024

Choose a reason for hiding this comment

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

Maybe static_cast<bool> would be better? Same in the other places below

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not aware of any reason of why static_cast is better, so it falls under subjective preferences, imho.
As such, I usually prefer more concise variants.

Copy link
Contributor

Choose a reason for hiding this comment

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

For informational purposes: generally c-style cast tries all kinds of casts 🤓

I quote:

  1. When the C-style cast expression is encountered, the compiler attempts to interpret it as the following cast expressions, in this order:
    a) const_cast(expression);
    b) static_cast(expression), with extensions: pointer or reference to a derived class is additionally allowed to be cast to pointer or reference to unambiguous base class (and vice versa) even if the base class is inaccessible (that is, this cast ignores the private inheritance specifier). Same applies to casting pointer to member to pointer to member of unambiguous non-virtual base;
    c) a static_cast (with extensions) followed by const_cast;
    d) reinterpret_cast(expression);
    e) a reinterpret_cast followed by const_cast.

So the two casts are not really equivalent. But IMO it doesn't really matter and if we have any issue sanitizers will probably catch it :)

@romange romange merged commit 92be74f into main Oct 28, 2024
12 checks passed
@romange romange deleted the Pr1 branch October 28, 2024 15:40
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.

3 participants