home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:11816 comp.std.c++:998
- Newsgroups: comp.lang.c++,comp.std.c++
- Path: sparky!uunet!sybus.sybus.com!myrddin!tct!chip
- From: chip@tct.com (Chip Salzenberg)
- Subject: Re: run-time type checking, freezing, and thawing
- Message-ID: <2A78457A.561C@tct.com>
- Date: Thu, 30 Jul 1992 19:39:37 GMT
- References: <BryL9q.K5I@watcgl.waterloo.edu> <2A75837D.8B10@tct.com> <2TJ53BQ@netmbx.netmbx.de>
- Organization: TC Telemanagement, Clearwater, FL
- Lines: 40
-
- According to jrobie@netmbx.netmbx.de (Jonathan Robie):
- >chip@tct.com (Chip Salzenberg) writes:
- >>But once you've frozen a C++ object into a dead array of bytes, it's
- >>no longer a C++ object, so the C++ type system is no longer operative.
- >
- >RTTI is needed to properly freeze a C++ object into a "dead array of
- >bytes" ...
-
- Virtual functions are sufficient for freezing.
-
- >... and to turn a "dead array of bytes" into a C++ object.
-
- RTTI is of zero relevance to thawing. It doesn't make this code work:
-
- int i;
- char *buf;
- read(fd, &i, sizeof(int));
- buf = new char[i];
- read(fd, buf, i);
- XXX *foo = thaw_arbitrary_object(buf, i);
-
- For one thing, what is the XXX type? -- since there is no universal
- base class for C++ objects, there is no valid candidate. For another
- thing, how can thaw_arbitrary_object know the complete set of classes
- I might have written to the given file? -- it can't.
-
- >It is also needed to follow references among objects in RAM.
-
- I can do that without RTTI right now.
-
- >RTTI and persistence are related enough that all of the major C++
- >database systems use precompilers to get at it.
-
- The mere fact that RTTI can be used for freezing proves neither (1)
- that it is necessary for freezing, nor (2) that it is useful -- much
- less necessary -- for thawing.
- --
- Chip Salzenberg at Teltronics/TCT <chip@tct.com>, <73717.366@compuserve.com>
- "Do Rush place weird subliminal backmasked messages in their songs to
- compel unwilling geeks to commit evil .sig atrocities?" -- Dean Engelhardt
-