home *** CD-ROM | disk | FTP | other *** search
- John M. Dlugosz
- Dlugosz Software
- P.O. Box 867506
- Plano, TX 75023
- (214)985-8098
-
- The files here are the remains from my testing/exploring of the function
- overloading abilities of C++ compilers. Guidelines 1.2 and Zortech 1.07
- compilers were used. The files were edited as the tests were carried out,
- so they show the form of the last test in some cases. Some changes like
- the names of the include files don't have any bearing to the tests.
-
- The file OVERLOAD was used as a template for generating some of the other
- files.
-
- OV1 tests elementary overloading. Zortech could not compile it because it
- does not know if it should convert a char to an int or a double!
-
- OV2 tests what happens when an incorrect situation is presented. Guidelines
- gave an error and proceeded to generate code, ignoring the second (error
- causing) function. Zortech took it. These two tests show that Zortech
- recognizes a char when overloading, and does not have any idea what the
- correct precidence in converting is, when there is no exact match.
-
- OV2B reversed the order of the definitions. This conferms that Guidelines
- will ignore the second (error causing) function and continue after the
- error.
-
- OV3 is to further explore Zortech's mechanism. It can distinguish a char
- from an int argument, but it does follow the usual rules of operations
- promoting a char to an int for use in computations. The last call (float to
- double) was a control.
-
- OV4 All the conversions in level 1 are searched for at the same time, rather
- then one at a time within the level. This test (Guidelines only) shows
- positive. int to long and int to double are both level 1 conversions, and
- if both are present, an int causes an error.
-
- OV5 is to test that a unique solution in level 0 is not influenced by any
- solutions on other levels. Zortech failed.
-
- OV6 tests level 2 conversions. the foo(long) call has no solution on any
- level, since long to double, long to int, and long to complex do not exist.
- Guidelines reported an error, and Zortech converted long to double without
- telling me.
-
- OV7 removes foo(double) to see if the translator will automatically convert
- double to complex via the constructor.
-
- OV8 tests all three levels. One function from each level is present.
- Comment out any functions and see which one is called. The chart at the
- bottom summerizes the results for all three and any 2 functions present.
- Both compilers worked.
-
- OV9 tests overloading with member functions and inherited functions. At
- this time, I did not know the correct behavior. I found out that if any
- function is present in a class, then any other functions with the same name
- are not inherrited. I submitted a puzzle based on this to the C++ report
- and they printed the same problem as submitted by someone else. Of note is
- that in this situation, only 1 function is visible so both compilers correctly
- convert a char to a long without a warning.
-
- OV10 shows that an overloaded function in a base class does not behave as
- overloaded when one function is defined for the derived class. The definition
- in the derived class hides all functions by the same name in base classes.
- Of note is that Zortech would not compile the control case.
-
- OV11 shows another case where a function is overloaded in the base class and
- not overloaded in the derived class. In the derived class, arguments are
- converted to the proper type whenever possible (with warnings when
- appropreate). In the base class, the overloading mechanism trys to decide
- which of two visible functions to call.
-
- OV11B is a similar test for Zortech. Notice that it does not give a warning
- when it coerces a double to a long. The base class with 2 functions
- visible will not compile because Zortech does not know what to do with
- a char-- convert to int or double!
-
-