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 -Wconversion and other warnings #281

Merged
merged 7 commits into from
May 16, 2024
Merged

Conversation

waldgange
Copy link
Collaborator

No description provided.

@waldgange waldgange marked this pull request as ready for review May 13, 2024 13:41
@waldgange waldgange requested a review from a team as a code owner May 13, 2024 13:41
Signed-off-by: Anton Pryakhin <apryakhin1@bloomberg.net>
@678098 678098 self-assigned this May 13, 2024
@678098 678098 self-requested a review May 13, 2024 16:42
Copy link
Collaborator

@678098 678098 left a comment

Choose a reason for hiding this comment

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

Have some proposals and comments

src/groups/mqb/mqba/mqba_clientsession.cpp Outdated Show resolved Hide resolved
src/groups/mqb/mqbblp/mqbblp_cluster.cpp Outdated Show resolved Hide resolved
src/groups/mqb/mqbblp/mqbblp_cluster.cpp Show resolved Hide resolved
src/groups/mqb/mqbblp/mqbblp_cluster.cpp Outdated Show resolved Hide resolved
src/groups/mqb/mqbblp/mqbblp_domain.cpp Outdated Show resolved Hide resolved
src/groups/mwc/mwcc/mwcc_orderedhashmap.t.cpp Outdated Show resolved Hide resolved
src/groups/mwc/mwcu/mwcu_safecast.h Outdated Show resolved Hide resolved
src/groups/mwc/mwcu/mwcu_safecast.h Outdated Show resolved Hide resolved
src/groups/mwc/mwcu/mwcu_safecast.h Outdated Show resolved Hide resolved
src/groups/mwc/mwcu/mwcu_safecast.h Outdated Show resolved Hide resolved
Signed-off-by: Anton Pryakhin <apryakhin1@bloomberg.net>
Signed-off-by: Anton Pryakhin <apryakhin1@bloomberg.net>
Signed-off-by: Anton Pryakhin <apryakhin1@bloomberg.net>
Signed-off-by: Anton Pryakhin <apryakhin1@bloomberg.net>
Copy link
Collaborator

@678098 678098 left a comment

Choose a reason for hiding this comment

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

Almost there, the only concerning comment is about messageCount ceil

float messageCount = ceil(k_NUM_RECORDS / 3.0);
float outstandingRatio = float(partiallyConfirmedGUIDS.size() + 1) /
messageCount * 100.0;
const size_t messageCount = k_NUM_RECORDS / 3 + 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here, if k_NUM_RECORDS == 3:
the previous code will have messageCount == 1.0f
the updated code will have messageCount == 2

This should help

Suggested change
const size_t messageCount = k_NUM_RECORDS / 3 + 1;
const size_t messageCount = (k_NUM_RECORDS + 2) / 3;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice suggestion! The test won't break if we change k_NUM_RECORDS in the future

100.0;
const size_t messageCount = k_NUM_RECORDS / 3;
const float outstandingRatio = float(outstandingGUIDS.size()) /
float(messageCount) * 100.0f;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be good to use C++ static_casts here and below, not the C-style casts. We can do it in a separate PR if we don't want to increase the scope of this one

#else
const size_t k_NUM_ELEMENTS = 1000 * 1000; // 1M
const int k_NUM_ELEMENTS = 1000 * 1000; // 1M
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const int k_NUM_ELEMENTS = 1000 * 1000; // 1M
const int k_NUM_ELEMENTS = 1000 * 1000; // 1M

Copy link
Collaborator Author

@waldgange waldgange May 16, 2024

Choose a reason for hiding this comment

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

Yeah, this formatting looks strange, but that's exactly what clang-format did. CI fails otherwise, check this log

Signed-off-by: Anton Pryakhin <apryakhin1@bloomberg.net>
Copy link
Collaborator

@678098 678098 left a comment

Choose a reason for hiding this comment

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

Perfect!

@678098 678098 merged commit e0f5ee1 into bloomberg:main May 16, 2024
14 checks passed
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