home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18772 < prev    next >
Encoding:
Text File  |  1993-01-06  |  6.1 KB  |  119 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!microsoft!wingnut!jimad
  3. From: jimad@microsoft.com (Jim Adcock)
  4. Subject: Re: Standard library functions and macros
  5. Message-ID: <1993Jan06.190203.5785@microsoft.com>
  6. Date: 06 Jan 93 19:02:03 GMT
  7. Organization: Microsoft Corporation
  8. References: <1993Jan2.191336.28542@taumet.com> <1993Jan04.231519.8704@microsoft.com> <1993Jan5.185023.3646@taumet.com>
  9. Lines: 108
  10.  
  11. In article <1993Jan5.185023.3646@taumet.com> steve@taumet.com (Steve Clamage) writes:
  12. |jimad@microsoft.com (Jim Adcock) writes:
  13. |
  14. |>How about implementations and programmers that want to continue to
  15. |>share code between C and C++ implementations?  Let's say a program
  16. |>that it created from some "C" files and some "C++" files, and each of
  17. |>these files in turn calls some of the standard-C functions.  How are
  18. |>you going to make this work?  Seems to me you are requiring 
  19. |>"C++ calling convention" of the standard-C functions called by the
  20. |>C++ files, whereas the standard-C functions called from the "C" files
  21. |>would have to follow "C" calling convention.
  22. |
  23. |Not at all.  The C++ implementation is allowed to use C linkage for the
  24. |C library functions.  It is merely not required to do so.
  25.  
  26. Agreed.  An implementation that uses C calling convention for its 
  27. library functions shouldn't need stubs, as long as the parms to the
  28. C++ standard definition of the function remains identical to the C
  29. standard definition.  If the C++ implementation uses a different
  30. calling convention than the C implementation, then you have to have
  31. the stubs.
  32.  
  33. |There is not and never was any claim that you can choose any C and any
  34. |C++ implementation arbitrarily and create a mixed program.  The compilers
  35. |have to agree on a number of implementation details.  If a C++
  36. |implementation isn't compatible with the C implementation you intend to
  37. |use, don't buy it.
  38.  
  39. I'm simply arguing that it must be reasonable to maintain such dual-
  40. implementation compatibility.  If the C++ committee makes decisions that
  41. make such dual-compatibility onerous, then I say they are clearly making 
  42. a mistake.
  43.  
  44. |The existence proof you requested:  My company provides a mixed C/C++
  45. |implementation (Oregon C++).  We arrange things so that code compiled
  46. |with our compiler in either C or C++ mode can be mixed with code
  47. |compiled with the "native" C compiler for the OS.  You can also mix C
  48. |code compiled with the native headers and the native compiler with code
  49. |compiled with our headers and our compiler (in any mixture of C and C++).
  50. |Our headers use inline functions for some functions which are macros in
  51. |the native C headers, and even contain code along these lines:
  52. |    #if __cplusplus
  53. |    inline T somefunc(args) { ... }
  54. |    #else
  55. |    #define somefunc(args) ...
  56. |    #endif
  57. |This kind of thing simply isn't a problem.
  58.  
  59. Depends on what you consider a problem.  The C++ side of your implementation
  60. does not support the semantics called out in one of the base documents,
  61. namely the ANSI-C base document.  If this is not a problem, then why
  62. call the ANSI-C document a base document?
  63.  
  64. Whenever C++ fails to implement the requirements of the ANSI-C side of
  65. the base docs, you make it less likely that C programmers will make the
  66. effort to move their code to C++.  Thus the dual mode C/C++ implementations
  67. and programmers written half ANSI-C half C++ will continue indefinitely.
  68.  
  69. |A new C++ rule is that for portability you should include standard headers
  70. |rather than declaring the standard functions yourself.  We can argue
  71. |about whether this constitutes an unacceptable burden on the programmer.
  72. |The C++ committee concluded it did not, after careful consideration for
  73. |over a year by many people.  If you disagree, it would help to supply
  74. |some sort of statistics or even a survey to back up your opinion.
  75.  
  76. No, I do not disagree with this part of the decision.  I simply disagree
  77. that it makes sense to return the vast majority of the standard functions
  78. namespace to the programmer.  On the contrary I claim that the vast majority
  79. of these names should remain in the implementation space, because implementing
  80. them as macros, or providing alt implementations, as in the Sun example, 
  81. remain useful and viable options to the implementation.  Whereas the vast
  82. majority of the names in question represent deliberately "decorated" or
  83. "mangled" names if you will that have little or no applicability to the
  84. C++ programmer as useful member function names, or even global names.
  85. So in the vast majority of cases your suggested changes destroy utility
  86. on the implementor's side without corresponding increase in utility on 
  87. the programmer's side.  This is clearly a bad trade-off.  Again, if you
  88. want to go through the functions in a sensible manner, and choose certain
  89. names such as "free" that have plausible utility to the end programmer,
  90. and insist on non-macro and non-overloaded implementation of these functions,
  91. such that the name-space remains available to the programmer, then I would
  92. agree with such a thoughtful, well-considered, measured approach.  I just
  93. disagree with the blanket changes that have been proposed to date.
  94.  
  95. |>|A few weeks ago I asked for analyses of this situation, or of any other
  96. |>|problem associated with the change in C library rules for C++.  I did
  97. |>|not get any response.  I renew the request.  If the Committee has made
  98. |>|a bad decision, this is the time to correct it.
  99. |
  100. |>Consider my arguments here as a response to your request.
  101. |
  102. |Posting to this newsgroup is not a submission to the C++ committee.
  103.  
  104. You did not call for a submission to the C++ committee.  You issued
  105. an open request for responses in this forum, and I responded in this
  106. forum.  Now you continue to make excuses to discount such responses.
  107. If you do not wish to consider responses in this forum, then do not
  108. call for such responses here.  Make such [rhetorical] calls in committee, 
  109. and leave this forum alone.
  110.  
  111. |Your organization is a member of the committee; write a concrete
  112. |proposal (i.e., specific changes to the Working Paper) and give it
  113. |to one of your representatives.
  114.  
  115. I have written up a concrete proposal in the past, and the committee
  116. did not give it any more reasoned consideration than you give my
  117. comments here.  I will not so waste my efforts again.
  118.  
  119.