home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11485 < prev    next >
Encoding:
Internet Message Format  |  1992-07-24  |  2.0 KB

  1. Xref: sparky comp.lang.c++:11485 comp.std.c++:942
  2. Newsgroups: comp.lang.c++,comp.std.c++
  3. Path: sparky!uunet!ftpbox!motsrd!news
  4. From: shang@corp.mot.com (David (Lujun) Shang)
  5. Subject: Re: Language extensions for run-time type identification
  6. Message-ID: <1992Jul24.135609.19575@cadsun.corp.mot.com>
  7. Sender: news@cadsun.corp.mot.com
  8. Reply-To: shang@corp.mot.com
  9. Organization: Motorola, Inc., Software Research and Development, Rolling Meadows, IL. 60008
  10. References: <1992Jul24.012050.6092@hellgate.utah.edu>
  11. Date: Fri, 24 Jul 92 13:56:09 GMT
  12. Lines: 30
  13.  
  14. In article <1992Jul24.012050.6092@hellgate.utah.edu>  
  15. clark%asylum.cs.utah.edu@cs.utah.edu (Charles Clark) writes:
  16. > Yes, compatibility with C structs is compromised by this scheme of
  17. > hijacking the vtable to provide run-time type id.  If you just can't
  18. > give up on this scheme, and are determined to make it work -- no matter
  19. > what -- here are a couple other patches to consider:
  20. > (a) Modify the C compiler to provide RTTI for structs, using the same
  21. >     technique.  (After modifying the C++ compiler you'll be good at this
  22. >     kind of thing... :-} ).
  23.  
  24. Each argument in C is specified by a unique type and a typecast in C is  
  25. definitely a cast between two different types (if we view void as a concrete  
  26. type). There for C DOES NOT need RTTI. It is not a good idea to enforce a C++  
  27. penalty to C.
  28.  
  29. > (b) Force the use of a linkage specifier for, not only C functions, but
  30. >     also C structs.  No type identification would be provided for C structs
  31. >     (both C++ classes and structs would have RTTI).
  32. This is not a good solution either. Within a C++ module, we should not  
  33. distinguish what is C struct, what is C++ struct, or what is C int and what is  
  34. C++ int. The only distinguish should be made is that what module is written in  
  35. C and what module is written in C++. For those module written in C, we still  
  36. can add RTTI for those types and struts contained in the head files for C++  
  37. environment IF IT IS REQUIRED (although the C programms never use RTTI).
  38.  
  39. David Shang
  40.