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

Multiple min functions with different behaviour #1391

Closed
DorpsGek opened this issue Nov 2, 2007 · 3 comments
Closed

Multiple min functions with different behaviour #1391

DorpsGek opened this issue Nov 2, 2007 · 3 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Nov 2, 2007

Maedhros opened the ticket and wrote:

We appear to have min as a template and as a function (along with minu), but the functions and the template do different things if a == b. This strikes me as a disaster waiting to happen, somehow. ;-)

P.S. Sorry I couldn't come and mention it on IRC, but this weekend is becoming ridiculously busy for me. :-)

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/1391
@DorpsGek
Copy link
Member Author

DorpsGek commented Nov 2, 2007

Rubidium wrote:

How can this ever be a real problem?
a < b => always a
a > b => always b
a == b => we really do not care as a and b have the same value.

Secondly the min and minu functions are there so the C++ compiler can 'easily' find out how to match it as there are loads of places where the input parameters are not the same. Comparing uint and uint16 for example. Unless you have a good idea how to make the template in such a manner that it does "the right thing", I don't think there is a chance of getting the min and minu functions removed.


This comment was imported from FlySpray: https://bugs.openttd.org/task/1391#comment2567

@DorpsGek
Copy link
Member Author

DorpsGek commented Nov 5, 2007

skidd13 wrote:

Here are two possible solutions for the problem:

  1. Cast all the function arguments (Hmm clean solution cause more people see what you are doing right now)
  2. The first argument forces the type of the second (which is IMO not a clean way)

This comment was imported from FlySpray: https://bugs.openttd.org/task/1391#comment2615

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Fixed

In r11401.


This comment was imported from FlySpray: https://bugs.openttd.org/task/1391

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant