home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!rpi!masscomp!peora!tarpit!fang!att!dptg!ulysses!allegra!alice!ark
- From: ark@alice.att.com (Andrew Koenig)
- Newsgroups: comp.lang.c++
- Subject: Re: Renew?
- Message-ID: <23322@alice.att.com>
- Date: 26 Jul 92 23:06:28 GMT
- References: <memo.542965@cix.compulink.co.uk>
- Reply-To: ark@alice.UUCP ()
- Organization: AT&T Bell Laboratories, Liberty Corner NJ
- Lines: 18
-
- In article <memo.542965@cix.compulink.co.uk> vadim@cix.compulink.co.uk writes:
-
- > ObjWithRenew *p;
- > p = (ObjWithRenew *)realloc(old, newsize);
- > p->renewed(s); // We can do this because realloc copied
- > // the vptr too
-
- No such luck. People are entitled to write classes whose objects,
- for example, store their addresses in other data structures. In general,
- you cannot expect to be able to copy the bits that represent an
- arbitrary object from here to there without breaking things.
-
- Moreover, implementations that use pointers rather than offsets to
- locate virtual base classes are guaranteed to break under such movement.
- That includes all cfront-based implementations.
- --
- --Andrew Koenig
- ark@europa.att.com
-