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

Use std::min replace min #1783

Merged
merged 1 commit into from
Aug 6, 2024
Merged

Use std::min replace min #1783

merged 1 commit into from
Aug 6, 2024

Conversation

KangLin
Copy link
Contributor

@KangLin KangLin commented Jul 22, 2024

Use std::min replace min

@KangLin KangLin force-pushed the min branch 4 times, most recently from aa17e90 to 38ec9eb Compare July 22, 2024 07:06
Copy link
Member

@CendioOssman CendioOssman left a comment

Choose a reason for hiding this comment

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

The PR looks mostly fine, but I'm unclear to the motivation. You mention "cross-platform", but how does this change improve that?

@KangLin KangLin force-pushed the min branch 4 times, most recently from d5da453 to 8dca051 Compare July 25, 2024 04:54
@KangLin KangLin force-pushed the min branch 4 times, most recently from 1d0762c to 86fdd25 Compare July 26, 2024 01:55
Copy link
Member

@CendioOssman CendioOssman left a comment

Choose a reason for hiding this comment

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

I think the code looks good now. But I'm still not clear on the rationale. What was the reason you started working on this fix?

@KangLin
Copy link
Contributor Author

KangLin commented Jul 29, 2024 via email

Copy link
Member

@CendioOssman CendioOssman left a comment

Choose a reason for hiding this comment

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

  • There are standard functions available, so why define them yourself?

Generally, that's a good principle. But std::min() has some bad behaviours based on the fact that it is implemented as a template, which means it isn't always a good fit.

We also don't want to avoid creating unnecessary history, as that makes git blame annoying to use. In other words, there should be a decently sized cleanup.

That said, this didn't change too many lines. So I can accept this if it makes things easier for you.

  • I am will use to msvc.

Ah. That's not one of our normally used compilers, but it's always a plus if we're more compatible.

@CendioOssman CendioOssman merged commit ff50780 into TigerVNC:master Aug 6, 2024
11 checks passed
@KangLin
Copy link
Contributor Author

KangLin commented Aug 6, 2024

But std::min() has some bad behaviours based on the fact that it is implemented as a template, which means it isn't always a good fit.

Please describe any bad behaviours?

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.

2 participants