Practical limit on size of class

Discussion in 'C++' started by vijay, Jul 21, 2003.

  1. vijay

    vijay Guest

    Fowllowing is the experpts of a C++ documents associated with Itanium ABI
    Can some body explain what exctly this mean
    "The offset of a non-virtual base subobject in the full object containing it
    must be representable by a 56-bit signed integer (due to RTTI
    implementation). This implies a practical limit of 2**55 bytes on the size
    of a class.

    Thanks
    Vijay
    vijay, Jul 21, 2003
    #1
    1. Advertising

  2. vijay

    David White Guest

    vijay <> wrote in message
    news:bffuld$hui$...
    > Fowllowing is the experpts of a C++ documents associated with Itanium ABI
    > Can some body explain what exctly this mean
    > "The offset of a non-virtual base subobject in the full object containing

    it
    > must be representable by a 56-bit signed integer (due to RTTI
    > implementation). This implies a practical limit of 2**55 bytes on the size
    > of a class.


    The document mixes up bits and bytes. Assuming it's bits, a 56-bit signed
    integer is capable of representing a value +/- 2 to the power of 55. So the
    size of an object can't be larger than that if the implementation needs to
    keep its size in such an integer. This is no doubt a limit imposed by a
    specific compiler on a given machine. Every compiler has to impose
    reasonable limits for everything.

    Were you thinking that 2**55 is too small?

    DW
    David White, Jul 21, 2003
    #2
    1. Advertising

  3. vijay

    David White Guest

    David White <> wrote in message
    news:7LLSa.963$...
    > The document mixes up bits and bytes.


    My mistake, since the size (of the object) will be in bytes.

    DW
    David White, Jul 21, 2003
    #3
  4. vijay wrote:

    > Following is the experts of a C++ documents associated with Itanium ABI
    > Can some body explain what exactly this means
    > "The offset of a non-virtual base subobject in the full object containing it
    > must be representable by a 56-bit signed integer
    > (due to RTTI implementation).
    > This implies a practical limit of 2**55 bytes on the size of a class.


    What!
    That's only about 36 quadrillion bytes!
    Totally unacceptable.
    E. Robert Tisdale, Jul 21, 2003
    #4
  5. vijay wrote:
    > Fowllowing is the experpts of a C++ documents associated with Itanium ABI
    > Can some body explain what exctly this mean
    > "The offset of a non-virtual base subobject in the full object containing it
    > must be representable by a 56-bit signed integer (due to RTTI
    > implementation). This implies a practical limit of 2**55 bytes on the size
    > of a class.
    > ...


    It means what it says. It means that in order to support some
    RTTI-related functionality (like, for example, 'dynamic_cast' downcasts)
    in multiple-inheritance object hierarchy the program needs to know and
    be able to store offsets of base class subobjects of virtually any
    object at run time. In the above implementation this information happens
    to be stored in 56-bit signed integer field with +-2**55 value range.
    Under this circumstances the implementation is forced to use 2**55 as
    object size limit, since permitting base class subobjects larger than
    2**55 bytes may easily result in offset values out of +-2**55 range.

    --
    Best regards,
    Andrey Tarasevich
    Brainbench C and C++ Programming MVP
    Andrey Tarasevich, Jul 21, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. E11
    Replies:
    1
    Views:
    4,742
    Thomas Weidenfeller
    Oct 12, 2005
  2. Replies:
    1
    Views:
    780
    Ingo R. Homann
    Oct 26, 2005
  3. Replies:
    1
    Views:
    1,077
    Victor Bazarov
    Jun 28, 2005
  4. Jason Cavett

    Preferred Size, Minimum Size, Size

    Jason Cavett, May 23, 2008, in forum: Java
    Replies:
    5
    Views:
    12,563
    Michael Jung
    May 25, 2008
  5. Todd Burch

    Class Overkill? What's practical?

    Todd Burch, Jul 23, 2007, in forum: Ruby
    Replies:
    5
    Views:
    123
    Kaldrenon
    Jul 23, 2007
Loading...

Share This Page