Message from discussion
Ideas on RTTI support?
Path: g2news1.google.com!news4.google.com!goblin2!goblin.stu.neva.ru!feed1.news.be.easynet.net!news.weisnix.org!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail
From: "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
Subject: Re: Ideas on RTTI support?
Newsgroups: alt.os.development,comp.lang.misc
User-Agent: 40tude_Dialog/2.0.15.1
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Reply-To: mail...@dmitry-kazakov.de
Organization: cbb software GmbH
References: <4a516244-9d26-4e26-b46a-9d5a0b0823fd@m19g2000yqk.googlegroups.com> <h1fc6u$vht$1@aioe.org>
Date: Fri, 19 Jun 2009 09:54:57 +0200
Message-ID: <pvpvu6vo1ahz$.81meb7ad8cfn.dlg@40tude.net>
Lines: 48
NNTP-Posting-Date: 19 Jun 2009 09:54:57 CEST
NNTP-Posting-Host: 04435e37.newsspool2.arcor-online.net
X-Trace: DXC=eNSdiRXXbHGj7E:bke<5HFA9EHlD;3YcB4Fo<]lROoRA^YC2XCjHcbIdCc[TJoBeNLDNcfSJ;bb[EFCTGGVUmh?DLK[5LiR>kgB61VE4B[f6_C
X-Complaints-To: usenet-abuse@arcor.de
On Fri, 19 Jun 2009 02:50:23 -0400, Rod Pemberton wrote:
> "Scott Balmos" <sbal...@fastmail.fm> wrote in message
> news:4a516244-9d26-4e26-b46a-9d5a0b0823fd@m19g2000yqk.googlegroups.com...
>> [snip]
>> Has anyone ever attempted writing C++ RTTI support in an OS, if not in
>> a kernel?
>
> No, I use C. I'll listen to your idea though. But, I'm not familiar with
> RTTI. Since I'm not, could you explain why or what you're wanting to do in
> your OS?
>
> I mean, from what I've been able to gather about RTTI, it's a C++ feature
> that apparently allows you to perform a validity check on a type cast or
> type conversion at runtime instead of at compile time. What advantage does
> doing this at runtime have? What I'm trying to ask is, once your code is
> compiled and passes the compile time checks for a specific cast or
> conversion, why would it also need to do a runtime check? I'm assuming this
> has something to do with C++'s programming paradigm... Overloading?
Checking is a wrong word, identification is a correct one. The type
identification is necessary to be able to perform dynamic dispatch. Since C
is does not have polymorphic objects there is no dispatch and no need in
identification.
As for OS support there are problems with it:
1. Reuse of the type identifiers (tags), after the type dies (leaving its
scope). The tags should be dense or hashable in order to have dispatch
efficient.
2. Global scope of the tags. In a distributed OS you will need to have
unique tag for whatever possible type.
3. Persistence (stored polymorphic objects must keep their unique type
tags)
4. Language impedance. Some languages like C++ define the way type tags
must behave, which is inconsistent, limiting, and inefficient for more
advanced OO languages. It might be difficult to find a common denominator.
I guess that tags (and dispatching tables) would have much in common with
the virtual memory management.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de