Re: Member Functions

From: David White (no_at_email.provided)
Date: 03/29/05


Date: Tue, 29 Mar 2005 12:22:47 +1000


"James Dennett" <jdennett@acm.org> wrote in message
news:3TN1e.1848$k57.1060@fed1read07...
> Code for a member function exists in only one place, and unless
> that member function is virtual there's not even need for per-
> class storage for a pointer to it. Virtual functions generally
> occupy some space for their code and also a slot in a virtual
> function table (often abbreviated to vtbl), but even then the
> virtual function table is only created once for the class, and
> each instance of a class which has a vtbl includes just a pointer
> to that vtbl.
>
> I should mention that this is not mandated by the standard, but
> is a (near-?) universal implementation technique, and can be
> helpful in understanding the typical costs of design choices.

If it's not mandated by the standard, is it ever possible, at least in
theory, for one pointer to a member function (virtual or not) to be not
equal to another pointer to the same member function?

DW



Relevant Pages

  • Re: Function Pointer Query
    ... Note that pointer to member function is incompatible with regular ... needs a callback, you are sadly out of luck. ... void EnumWindows; ...
    (microsoft.public.vc.language)
  • Re: Why pointer to member function?
    ... I want a simple,clean,cheap way that can save the member function ... fixed for any type of closure. ... don't want to save a pointer to a pointer to a member function ... the boost lib does prove that I'm not wrong on this. ...
    (comp.lang.cpp)
  • Re: c[++] pointer question
    ... A pointer is a variable that contains a memory address. ... The above are member variables. ... A constructor is a special member function that is meant to initialize ... In modern C++ the initialization is better done via an initializer list, ...
    (comp.lang.cpp)
  • Re: Basic question regarding checkboxes
    ... It appears that your real problem is not understanding that the above call is to a C++ member function. ... Your error message shows you are not calling the MFC version of CheckDlgButton but attempting to call the API version. ... The MFC version is a member function of the dialog and it "knows" the HWND of the dialog. ... If you are making this call in some code module that is not part of the dialog then first you have to call that module, passing it the 'this' pointer from the dialog object. ...
    (microsoft.public.vc.mfc)
  • Re: A C++ Whishlist
    ... > You invoke undefined behaviour and the compiler is free to do as it ... > calls a member function via a NULL pointer. ... > means that it doesn't invoke undefined behaviour, ... > undefined behaviour until you invoke a member function via a NULL ...
    (comp.lang.cpp)