Pointer-to-member

Discussion in 'C++' started by void, Jan 27, 2004.

  1. void

    void Guest

    U¿ytkownik hari4063 napisa³, On 2004-01-27 09:58:

    > Hay,
    > I decalre pointer-to-member and it's sizeof iz 12 (in Borland 5) or 4 (in MinGW)? When I debugged code, only parameters pushed on stack is 'this' and call was indirect?
    > What other 2 dwords are?
    >
    >


    Please read link below:
    http://www.informit.com/isapi/guide~cplusplus/seq_id~137/guide/content.asp

    Paragraph:
    The Underlying Representation of Pointers to Members

    Best regards
    Darek Ostolski
    --
    "C makes it easy to shoot yourself in the foot; C++ makes
    it harder, but when you do, it blows away your whole leg."
    - Bjarne Stroustrup
     
    void, Jan 27, 2004
    #1
    1. Advertising

  2. void

    hari4063 Guest

    Hay,
    I decalre pointer-to-member and it's sizeof iz 12 (in Borland 5) or 4 (in MinGW)? When I debugged code, only parameters pushed on stack is 'this' and call was indirect?
    What other 2 dwords are?
     
    hari4063, Jan 27, 2004
    #2
    1. Advertising

  3. void

    hari4063 Guest

    Thanks!
     
    hari4063, Jan 27, 2004
    #3
  4. void wrote:
    >> I decalre pointer-to-member and it's sizeof iz 12 (in Borland 5) or 4 (in MinGW)? When I debugged code, only parameters pushed on stack is 'this' and call was indirect?
    >> What other 2 dwords are?
    >>
    >>

    >
    > Please read link below:
    > http://www.informit.com/isapi/guide~cplusplus/seq_id~137/guide/content.asp
    >
    > Paragraph:
    > The Underlying Representation of Pointers to Members
    > ...


    Hmm... The above text doesn't explain much and also it contains the
    following statement

    "Thus, the simplest member function can be represented as a set of two
    pointers: one holding the physical memory address of the member
    function, and a second pointer that holds the 'this' pointer."

    This is, of course, incorrect. Member function pointers in C++ are not
    tied to any concrete object and, therefore, do not need to store any
    'this' pointers.

    In one popular implementation on a 32-bit platform a 8-byte member
    function pointer holds two values: a entry point to the function and a
    "delta" value used by pointer conversions in hierarchies with multiple
    inheritance (adjusting 'this' pointer). This could be exactly what the
    author of the above article meant (although I seriously doubt that), but
    the current wording is definitely misleading

    --
    Best regards,
    Andrey Tarasevich
     
    Andrey Tarasevich, Jan 27, 2004
    #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. Newsgroup - Ann
    Replies:
    5
    Views:
    635
    John Carson
    Jul 30, 2003
  2. Fraser Ross
    Replies:
    4
    Views:
    1,070
    Fraser Ross
    Aug 14, 2004
  3. Stephen Howe
    Replies:
    2
    Views:
    298
    Stephen Howe
    Nov 6, 2012
  4. somenath
    Replies:
    10
    Views:
    295
    James Kanze
    Jul 2, 2013
  5. somenath
    Replies:
    2
    Views:
    170
    somenath
    Aug 29, 2013
Loading...

Share This Page