From: Daryle Walker (darylew_at_[hidden])
Date: 2000-11-08 15:25:44
on 11/7/00 7:02 PM, Kevlin Henney at kevlin_at_[hidden] wrote:
> In message <18.104.22.168.2.20001107131644.02301a80_at_[hidden]>, Beman
> Dawes <beman_at_[hidden]> writes
>> At 04:56 PM 11/7/2000 +0000, Kevlin Henney wrote:
>>>> * What's the typical sizeof() of an object of class any?
It's nonsensical question because there is never a non-typical sizeof() for
class "any," or for any type. The sizeof() value is a compiler-computed
constant. It's the sum of the base classes' sizeof() values (with special
rules for virtual stuff), the non-static direct member' sizeof() values, and
any padding. Remotely-owned data is never considered.
>>> Interesting: Do we wish to be documenting at this level for Boost
>>> classes in general?
>> In general, no. But class any is a bit of an odd-ball in that it is so
>> flexible with regard to types, and that raised the question in my mind. I
>> found myself looking at the actual code. That's why the issue was raised.
Even if class "any" is flexible with regard to types, its sizeof() is still
> It's not too much of a burden on the documentation -- "sizeof(any) ==
> sizeof(T *) + implementation-defined padding" :-> -- so I will include
Why bother? The value must be constant, and the user generally doesn't need
to know it. If the size is needed in a program, the user can use
"sizeof(any)" in his/her code. However, if the user needs the size of the
contained object, maybe you could add a size() method.
I may be objecting too harshly. If you want to put it in an implementation
section of the docs, go ahead. (Make sure to warn the reader that these
details can change anytime.)
-- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk