🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: de.comp.gnu
Article #105

Re: Problem mit RTTI und gcc/libg++ 2.7.0

#105
From: Ralf W. Stephan
Date: Mon, 16 Oct 1995 11:17
49 lines
2349 bytes
Bjoern Dosch writes:
> (gdb) bt
> #0  0x1f34c in istream::getline (this=0xeffff93c, buf=0xeffff868 "", len=128, 
>     delim=10 '\n') at isgetline.cc:38
> #1  0x183b4 in main () at test.cc:16

Dazu passend ein Artikel aus gnu.g++.help:

From: bashford@toad.scripps.edu (Don &)
Subject: Re: Run Time Type Identification
Date: 12 Oct 1995 05:22:15 GMT
Message-ID: <BASHFORD.95Oct11222215@toad.scripps.edu>

>>>>> "Alex" == Alex Martelli <martelli@cadlab.cadlab.it> writes:

    Alex> douvilld@Cognos.COM (Derek Douville) writes:
    >> I would like to know if the latest version of the Gnu g++
    >> compiler supports RTTI (i.e. typeid() and before() etc).  If I
    >> include <typeinfo.h> and use one of these functions, I get a
    >> "not supported" message.  I am running gnu v 2.6.2.

    Alex> Should work fine with g++ 2.7.0, compiling with -frtti of
    Alex> course.

Well, sort of.  RTTI is still an "alpha" feature of g++.
First of all you must include <typeinfo> not <typeinfo.h>.
ALL of the files that you link together must by compiled with -frtti
and must include <typeinfo> whether they use RTTI or not.  In
principle, even libg++ must be compiled this way (see the g++ FAQ).
However, I have found that code of mine that uses just the
String class and cin, cout and cerr works okay even though my
libg++ is not compiled with RTTI.  I can't use fstreams or
strstreams though (compiles and links but dumps core).

Within the above limitations, I have found that RTTI works
pretty much as I expected to.  In a "toy" implementation I
have been able to use to implement multi-methods and virtual
constructors in a much nicer way than I could before.

By the way, do any of the g++ maintainers know if the next version
(2.7.1?) will lift some of these limitations? 

Don Bashford
bashford@scripps.edu


ralf
--
PGP: 1024/0xA713ECE9 2047/0xC8E605F5
Technical Details
Message-ID: <1995Oct16.111754.19539@ark.franken.de>
Path: arc1-ca.pugleaf.net!ark.franken.de!ralf
References: <45rb40$61l@neuromancer.charon.incubus.sub.org>

Show Full Headers
Complete Article Headers
Newsgroups: de.comp.gnu,de.comp.lang.c++
Path: arc1-ca.pugleaf.net!ark.franken.de!ralf
From: ralf@ark.franken.de (Ralf W. Stephan)
Subject: Re: Problem mit RTTI und gcc/libg++ 2.7.0
Message-ID: <1995Oct16.111754.19539@ark.franken.de>
Organization: his desk writing an article
Date: Mon, 16 Oct 1995 11:17:54 GMT
References: <45rb40$61l@neuromancer.charon.incubus.sub.org>
X-Newsreader: TIN [version 1.2 PL2]
Followup-To: de.comp.gnu,de.comp.lang.c++