I am using Delphi 5
Hopefully this is an easy one and probably just a fundamental problem with my understanding of duplicated functions in units and "uses"
My understanding is that if you have two units that have the same function name, then the function in the last unit in your uses clause "wins"
For example, both units a.pas and b.pas have a min() function. If the uses clause was:
Then I would expect the min() function in unit b.pas to be used.
This appears to be the behavior I have experienced ever since using Delphi. However, I just recently added a new unit at the very beginning of my uses clause. I added this unit because I needed to use one of the functions it contains. This unit has many functions, one of which is the Min() function.
When I try to compile my program I get an error because my use of the min() function has invalid syntax. This is because I am using the syntax of the min() function from the standard Delphi "math" unit. The error *appears* to be happening because the compiler is picking up the min() function from my new unit. The "math" unit has been placed *after* my new unit in the uses clause, so I can't understand why the compiler is using the min() function from the new unit.
I can (and have) fixed the problem by prefixing the function with the required unit as in "math.min()"
However, my big worry now is that other functions in this new unit (there are many) may be used that have the same name as other functions I am using in my program. As the compiler has not picked up any errors, the syntax of the functions must be the same. However, I am worried there could be subtle logic differences if the functions in the new unit are used instead of the existing ones.
So is my understanding of how duplicated functions in units are resolved correct?
Is there some exception that I am overlooking that some how means the fist unit in the uses clause "wins" when it comes to function name duplication