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

[clang-tidy] NO.42-44 enable noexcept-move-constructor,unused-but-set-variable,security.FloatLoopCounter #61555

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

enkilee
Copy link
Contributor

@enkilee enkilee commented Feb 4, 2024

PR types

Others

PR changes

Others

Description

@paddle-bot paddle-bot bot added the contributor External developers label Feb 4, 2024
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Feb 7, 2024
@@ -186,7 +186,7 @@ void TablePrinter::CalcLayout() {
void TablePrinter::AddRowDivider(std::stringstream& ss) {
ss << "+";
for (float share : shares_) {
for (float j = 0; j < share + 2; ++j) ss << "-";
for (int j = 0; j < static_cast<int>(share) + 2; ++j) ss << "-";
Copy link
Contributor

Choose a reason for hiding this comment

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

如果 shares_是 float 类型,为什么一定要转成 int?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我是这样想的:
j的值如果是100.001,这样一来,最后一次的循环,就会因为100.001比100大0.001,导致最后一次循环被跳过,就会只循环99次。

@luotao1 luotao1 merged commit 54af517 into PaddlePaddle:develop Feb 20, 2024
32 checks passed
@enkilee enkilee deleted the clangtidy-44 branch March 4, 2024 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants