Changes in Overloading

The Delphi 2009 compiler sees quite a number of internal changes in the way the compiler chooses the function to call in the case of multiple overloaded versions where none of them is an exact match. This is particularly so when variants are involved.

There are two different situations you might come across:

  • Code that used to compile now issues a compiler error
  • Code that used to call one method now ends up calling a different one

Needless to say that while the first might be annoying it is easily fixed by adding an explicit type cast, while the second is much more subtle and dangerous, as you might only know that things go wrong only by running the program.

A complete case-by-case analysis would be extremely time consuming, as the combinations are almost endless. What I've done, instead, is to create a program with a few specific and interesting test cases, and show you what happens in Delphi 2007 and Delphi 2009. That's why in the VariantOver folder you'll find two projects, one for each of these versions of the IDE.

Was this article helpful?

0 0
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment