home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19664 < prev    next >
Encoding:
Text File  |  1993-01-21  |  3.0 KB  |  62 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!newsserver.jvnc.net!newsserver.technet.sg!nuscc!papaya!suresh
  3. From: suresh@papaya.iss.nus.sg (Suresh Thennarangam - Research Scholar)
  4. Subject: Re: Borland C++ Complete?
  5. Message-ID: <1993Jan21.041855.1950@nuscc.nus.sg>
  6. Sender: usenet@nuscc.nus.sg
  7. Organization: Institute Of Systems Science, NUS
  8. References: <1993Jan15.123610.9073@jarvis.csri.toronto.edu> <1993Jan16.075038.16467@netcom.com> <1993Jan18.094026.24916@jarvis.csri.toronto.edu>
  9. Date: Thu, 21 Jan 1993 04:18:55 GMT
  10. Lines: 50
  11.  
  12. In article <1993Jan18.094026.24916@jarvis.csri.toronto.edu> byu@sys.toronto.edu (Benjamin Yu) writes:
  13. >In article <1993Jan16.075038.16467@netcom.com> donahn@netcom.com (Don Ahn) writes:
  14. >>In article <1993Jan15.123610.9073@jarvis.csri.toronto.edu> byu@sys.toronto.edu (Benjamin Yu) writes:
  15. >>>1) I can't overload a function with default arguments in 
  16. >>>Borland C++.  For example:
  17. >>>    void initialize(int X = 0, int Y = 0);
  18. >>>    void initialize();
  19. >>>    Y.initialize();   <<- fails in compile
  20. >>    This is definitely an error,  you have no way of knowing
  21. >>    which initialize to call (i.e. do you mean initialize(0,0)
  22. >>    or initialize(void) ? If you look on page 316 of the 
  23. >>    Annotated c++ ref. manual, you will see that Stroustrup
  24. >>    agrees.
  25. >>    
  26. >
  27. >Hmm, I am not sure which definition I should follow.  I don't have ARM but have
  28. >The C++ Programming Language Second Edition by Stroustrup.  On page 588, I quote:
  29. >
  30. >   "A call of a given function name chooses, from among all functions by that name
  31. >    that are in scope and for which a set of conversions exists so that the
  32. >    function could possibly be called, the function that best matches the
  33. >    actual arguments."
  34. >
  35. >It then gives a whole list of conversion rules.  So Y.initialize() best matches
  36. >initialize(void), and that should be called!
  37.  
  38. Which conversion rule have you applied to draw this conclusion ?
  39.  
  40. Perhaps [1] Exact match: Sequences of zero or more trivial conversions are 
  41.             better than all other sequences. ..........
  42.  
  43. However in the above case that Benjamin  has stated there are no conversions 
  44. required for either candidate(to my knowledge :->). Default arguments does not 
  45. mean that a conversion from void to the type of the formal argument is made. 
  46. Indeed such a conversion is illegal.
  47.  
  48.  
  49.  
  50.       __                  
  51.      (_   / /  o_   o  o |_
  52.      __)/(_( __) (_(_ /_)| )_
  53.  
  54. ***************************************************************************
  55. * Suresh Thennarangam               *  EMail: suresh@iss.nus.sg(Internet) *
  56. * Research Scholar                  *         ISSST@NUSVM.BITNET          *
  57. * Institute Of Systems Science      *  Tel:  (065) 772 2588.              *
  58. * National University Of Singapore  *  Facs.: (065) 778 2571              *
  59. * Heng Mui Keng Terrace             *  Telex: ISSNUS RS 39988             *
  60. * Singapore 0511.                   *                                     *
  61. ***************************************************************************
  62.