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