[gmpi] Re: low level API

  • From: Tim Hockin <thockin@xxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Fri, 4 Feb 2005 08:15:19 -0800

On Fri, Feb 04, 2005 at 10:11:18AM -0500, gogins@xxxxxxxxxxxx wrote:
> To declare a new interface deriving from IUnknown in C, copy the
> IUnknownVirtualFunctionTable declaration, rename it, and add new
> function

Why copy it?  Why not just put a struct IUnknown at the head of the
"subclass".  You can then cast to IUnknown safely.  Or why not make an
INHERIT_IUNKNOWN macro that pastes that signature in, thus avoiding
copy-paste errors?

This is where C falls down.  If we could peek inside a member struct,
life
would be better.  E.g.:

struct parentclass {
        a
        b
}
struct subclass {
        struct parentclass; /* anonymous */
        foo
        bar
}

in this case, subclass->a should work.  But C is dumb.


----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: