home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c100 / 5.ddi / OVLOAD.ZIP / RESULTS.TXT < prev   
Encoding:
Text File  |  1989-06-18  |  3.8 KB  |  79 lines

  1. John M. Dlugosz
  2. Dlugosz Software
  3. P.O. Box 867506
  4. Plano, TX 75023
  5. (214)985-8098
  6.  
  7. The files here are the remains from my testing/exploring of the function
  8. overloading abilities of C++ compilers.  Guidelines 1.2 and Zortech 1.07
  9. compilers were used.  The files were edited as the tests were carried out,
  10. so they show the form of the last test in some cases.  Some changes like
  11. the names of the include files don't have any bearing to the tests.
  12.  
  13. The file OVERLOAD was used as a template for generating some of the other
  14. files.
  15.  
  16. OV1 tests elementary overloading.  Zortech could not compile it because it
  17. does not know if it should convert a char to an int or a double!
  18.  
  19. OV2 tests what happens when an incorrect situation is presented.  Guidelines
  20. gave an error and proceeded to generate code, ignoring the second (error
  21. causing) function.  Zortech took it.  These two tests show that Zortech
  22. recognizes a char when overloading, and does not have any idea what the
  23. correct precidence in converting is, when there is no exact match.
  24.  
  25. OV2B reversed the order of the definitions.  This conferms that Guidelines
  26. will ignore the second (error causing) function and continue after the
  27. error.
  28.  
  29. OV3 is to further explore Zortech's mechanism.  It can distinguish a char
  30. from an int argument, but it does follow the usual rules of operations
  31. promoting a char to an int for use in computations.  The last call (float to
  32. double) was a control.
  33.  
  34. OV4 All the conversions in level 1 are searched for at the same time, rather
  35. then one at a time within the level.  This test (Guidelines only) shows
  36. positive. int to long and int to double are both level 1 conversions, and
  37. if both are present, an int causes an error.
  38.  
  39. OV5 is to test that a unique solution in level 0 is not influenced by any
  40. solutions on other levels.  Zortech failed.
  41.  
  42. OV6 tests level 2 conversions.  the foo(long) call has no solution on any
  43. level, since long to double, long to int, and long to complex do not exist.
  44. Guidelines reported an error, and Zortech converted long to double without
  45. telling me.
  46.  
  47. OV7 removes foo(double) to see if the translator will automatically convert
  48. double to complex via the constructor.
  49.  
  50. OV8 tests all three levels.  One function from each level is present.
  51. Comment out any functions and see which one is called.  The chart at the
  52. bottom summerizes the results for all three and any 2 functions present.
  53. Both compilers worked.
  54.  
  55. OV9 tests overloading with member functions and inherited functions.  At
  56. this time, I did not know the correct behavior.  I found out that if any
  57. function is present in a class, then any other functions with the same name
  58. are not inherrited.  I submitted a puzzle based on this to the C++ report
  59. and they printed the same problem as submitted by someone else.  Of note is
  60. that in this situation, only 1 function is visible so both compilers correctly
  61. convert a char to a long without a warning.
  62.  
  63. OV10 shows that an overloaded function in a base class does not behave as
  64. overloaded when one function is defined for the derived class.  The definition
  65. in the derived class hides all functions by the same name in base classes.
  66. Of note is that Zortech would not compile the control case.
  67.  
  68. OV11 shows another case where a function is overloaded in the base class and
  69. not overloaded in the derived class.  In the derived class, arguments are
  70. converted to the proper type whenever possible (with warnings when
  71. appropreate).  In the base class, the overloading mechanism trys to decide
  72. which of two visible functions to call.
  73.  
  74. OV11B is a similar test for Zortech.  Notice that it does not give a warning
  75. when it coerces a double to a long.  The base class with 2 functions
  76. visible will not compile because Zortech does not know what to do with
  77. a char-- convert to int or double!
  78.  
  79.