Topic: Pointers to base classes (Was: VC++ bug (Was: empty base and copy assignment))


Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/09/01
Raw View
Vesa A J Karvonen wrote:
>
> Valentin Bonnard <Bonnard.V@wanadoo.fr> wrote:
> > Vesa A J Karvonen wrote:
> [snip]
> > > It seems to me that given the clause 5.10, there is very little, although
> > > significant, scope for storage optimization of base classes.
>
> > Is it _intended_ to apply to base class subobjects or just
> > to complete objects ?
>
> Clause 5.10 specifies

Perhaps you should check the meaning of intended.

corvette-~ $ webster intended
1in-tend-ed adj
(1586)
1: expected to be such in the future <an intended career> <his
     intended bride>
2: INTENTIONAL
-- in-tend-ed-ly adv
-- in-tend-ed-ness n

2intended n
(1767)
:the person to whom another is engaged: a fiance' or fiance'e


corvette-~ $ webster INTENTIONAL
in-ten-tion-al \in-'tench-nel, -'ten-chen-)el\ adj
(1677)
1: done by intention or design: INTENDED <intentional damage>
2a: of or relating to epistemological intention
2b: having external reference
syn see VOLUNTARY
-- in-ten-tion-al-i-ty \-,ten-che-'nal-et-e^-\ n
-- in-ten-tion-al-ly \in-'tench-ne-le^-, -'ten-chen-)el-e^-\
     adv

> In the previous example, consider that the pointer to the base class
> sub-objects are to distinct objects in the array. On MSVC++ they compare
> equal and on DEC C++ they compare unequal.

Of course I didn't meant that.

--

Valentin Bonnard
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: Vesa A J Karvonen <vkarvone@cc.helsinki.fi>
Date: 1999/08/31
Raw View
Valentin Bonnard <Bonnard.V@wanadoo.fr> wrote:
> Vesa A J Karvonen wrote:
[snip]
> > It seems to me that given the clause 5.10, there is very little, although
> > significant, scope for storage optimization of base classes.

> Is it _intended_ to apply to base class subobjects or just
> to complete objects ?

Clause 5.10 specifies (as related to my previous example) that two
pointers compare equal if and only if they point to the same object or one
past the end of the same array. I can't see anything in clause 5.10 that
would specificly limit it to apply only to base class sub-objects. The
behaviour of the example might not be specified, but I haven't found a
clause that would specificly say so.

In the previous example, consider that the pointer to the base class
sub-objects are to distinct objects in the array. On MSVC++ they compare
equal and on DEC C++ they compare unequal. I haven't tested the code on
another compiler, besides MSVC++, that performs the empty base
optimization. It would be quite interesting that pointers to sub-objects
of distinct objects might compare equal in certain cases.

---
Vesa Karvonen


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/08/30
Raw View
Vesa A J Karvonen wrote:

> Valentin Bonnard <Bonnard.V@wanadoo.fr> wrote:
> > Vesa A J Karvonen wrote:

> > This is a known bug in MSVC, caused by the fact that E takes
> > 0 bytes inside F, not sizeof(E) bytes.
>
> That's what I thought.

Yes, VC is incompatible with itself.

> It seems to me that given the clause 5.10, there is very little, although
> significant, scope for storage optimization of base classes.

Is it _intended_ to apply to base class subobjects or just
to complete objects ?

--

Valentin Bonnard


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]