The layout of C++ Object Model

Discussion in 'C++' started by skydrive, Oct 20, 2011.

  1. skydrive

    skydrive Guest

    Hi, I've just bought a copy of "Inside the C++ Object" book by
    Stanley B. Lippman. One thing that I want to know is that, is the C++
    Object Model implementation-defined by C++ Complier ? I haven't read C+
    + Standard mention a word about how the layout of model will be in the
    memory.

    Thanks.
    Dave
    skydrive, Oct 20, 2011
    #1
    1. Advertising

  2. On 10/20/2011 2:35 PM, skydrive wrote:
    > Hi, I've just bought a copy of "Inside the C++ Object" book by
    > Stanley B. Lippman. One thing that I want to know is that, is the C++
    > Object Model implementation-defined by C++ Complier ? I haven't read C+
    > + Standard mention a word about how the layout of model will be in the
    > memory.


    Not sure what you mean by "implementation-defined by C++ Compiler".
    Usually the behaviour that is "implementation defined", has to be
    documented by the implementation (the Standard requires that). Object
    layouts don't have to be documented. They are implementation-specific,
    no doubt about that, but not "defined" in the "published" sense.

    V
    --
    I do not respond to top-posted replies, please don't ask
    Victor Bazarov, Oct 20, 2011
    #2
    1. Advertising

  3. skydrive

    Christopher Guest

    On Oct 20, 2:52 pm, Victor Bazarov <> wrote:
    > On 10/20/2011 2:35 PM, skydrive wrote:
    >
    > > Hi, I've just bought a copy of  "Inside the C++ Object" book by
    > > Stanley B. Lippman. One thing that I want to know is that, is the C++
    > > Object Model implementation-defined by C++ Complier ?


    What does your book claim a "C++ Object Model" is anyway?
    Looks like a made up term to me.

    If we are talking about what Amazon wrote out the book:

    * differences between C++ structures and classes
    * default and copy constructors
    * data members
    * initialization
    * inheritance, including virtual inheritance
    * templates
    * exception handling
    * run-time type information

    Then these things are surely defined by the standard.
    Christopher, Oct 20, 2011
    #3
  4. On 20.10.2011 20:35, skydrive wrote:
    > Hi, I've just bought a copy of "Inside the C++ Object" book by
    > Stanley B. Lippman. One thing that I want to know is that, is the C++
    > Object Model implementation-defined by C++ Complier ? I haven't read C+
    > + Standard mention a word about how the layout of model will be in the
    > memory.


    Things like memory layouts are constrained by the standard, but not
    fully specified.

    And in particular, I believe Stanley is talking a good deal about vtable
    pointers and vtables, which is how in practice all C++ compilers
    implement virtual member functions (small variations between compilers).

    The standard does however not require that virtual member functions are
    implemented that way.

    Cheers & hth.,

    - Alf
    Alf P. Steinbach, Oct 21, 2011
    #4
    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. Rick Spiewak
    Replies:
    3
    Views:
    3,131
    Rick Spiewak
    Aug 26, 2003
  2. RobertH
    Replies:
    1
    Views:
    708
    Steve C. Orr [MVP, MCSD]
    Nov 4, 2003
  3. Replies:
    1
    Views:
    562
    John Timney \(MVP\)
    Jun 19, 2006
  4. Replies:
    1
    Views:
    471
    Andreas Wollschlaeger
    Oct 6, 2006
  5. sumsin

    C++ Object model layout

    sumsin, Jun 11, 2008, in forum: C++
    Replies:
    9
    Views:
    488
    EventHelix.com
    Jun 14, 2008
Loading...

Share This Page