From -4882872257024956275
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,206db806b836bf67
X-Google-Attributes: gidf78e5,public
From: "Bradd W. Szonye" <bradds@concentric.net>
Subject: Re: Pointers to incomplete type
Date: 1998/01/27
Message-ID: <6ajsuq$108@examiner.concentric.net>#1/1
X-Deja-AN: 319803766
References: <69osom$jf3@examiner.concentric.net><6a0a4g$rf1@shell.magma.ca><6a0t54$k83@examiner.concentric.net><6a3be4$6qu$1@uuneo.neosoft.com><6a7fli$gtj@examiner.concentric.net> <6aisf1$n8s$1@uuneo.neosoft.com>
X-Original-Date: Tue, 27 Jan 1998 00:54:19 -0500
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: Concentric Internet Services
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBNM5mOky4NqrwXLNJAQHTrwIAxT0qkc0ASlEqZhD/Y8jxNDs/tcPqpfW5 /O+6DOo7c595aqeBLt27uZgbu6SbkWoDu7nX9hzcZaeCpAa/BdZCkA== =Nwb/
Newsgroups: comp.std.c++
Originator: austern@isolde.mti.sgi.com


Bill Wade wrote in message <6aisf1$n8s$1@uuneo.neosoft.com>...
>
>If you just want smaller impact in the objects, make all pointers contain
>the vtable for the fully constructed, most derived object.  In the objects,
>use a single bit to indicate if it is fully constructed.  For partially
>constructed object use some other means (an expensive global mapping from
>pointers to current dynamic type) for dynamic type resolution.
>
>You could also have a slightly different language where even for partially
>constructed objects, virtual dispatch occurred using the fully constructed
>object's methods.

[Briefly: you're right about the vidx model not playing well with sl's.]

I wouldn't want that! If that were acceptable, I wouldn't worry so much
about the model being conforming. However, you did (indirectly) give me an
idea! The big clue was "use an expensive mapping" for the tricky case.

You might not be able to find a spare bit in the object, but you can do
something else. Instead of setting the global pointer to the most derived
class, give it a trap representation. Use some sort of snap technique (like
float emulation) to adjust the vptrs when used. I guess you'd still have to
store the "real" vptr somewhere (thereby losing at least some of the space
savings for this class), but then I don't expect that a lot of polymorphic
classes are handing out their this pointers during construction.

Thanks for the tip!
---
Bradd W. Szonye
bradds@concentric.net
http://www.concentric.net/~Bradds
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



