🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1936

Re: Extended typeinfo (was- dyn

#1936
From: mfinney
Date: Sat, 09 Sep 1995 16:08
38 lines
2251 bytes
In <n1401567773.54923@taligent.com>, "Bill Gibbons" <bill_gibbons@taligent.com> writes:
>The proposed extended_type_info is given below.

This "extended" RTTI is a good start, but it is still missing
something crucial to many programs.  That is the ability
to ask if object x is the same class or a subclass of a
type or another object.  This is especially important in
preconditions which have covariant parameters (such as
in operator=() as is common).

The draft standard RTTI allow you to ask if two types
are the same, but they do NOT allow you to ask about
relative inheritance.  The before() method of the type_info
class is NOT inheritance based.  This is something that
has surprised EVERYBODY that I know that has not read
the draft standard in detail.

This is a serious omission in the draft standard, and I
really cannot see a reason for not including it.  Nevertheless,
the committee seems to be afraid of things like this and
apparently only included the little RTTI capability they
HAVE included as a sop.

Implementing the above is fairly trivial, and I do so in
my class library via macros and preprocessor passes
that generate code to be included.  However, it is a
messy process, not easily maintained and requires that
the source code be written "just so".  This is not a very
good solution, but without compiler support (or pre-
compiler support), there doesn't seem to be a really
good solution.

Michael Lee Finney


[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <42rf97$p8h@mujibur.inmind.com>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
References: <n1401567773.54923@taligent.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: mfinney@inmind.com
Newsgroups: comp.std.c++
Subject: Re: Extended typeinfo (was- dyn
Date: 9 Sep 1995 16:08:16 GMT
Organization: In Mind, Inc.
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <42rf97$p8h@mujibur.inmind.com>
References: <n1401567773.54923@taligent.com>
Reply-To: mfinney@inmind.com
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: finneyman.inmind.com
X-Newsreader: IBM NewsReader/2 v1.2
Content-Length: 1440
Originator: clamage@taumet