[gmpi] Re: C++ detail question
- From: Tim Hockin <thockin@xxxxxxxxxx>
- To: gmpi@xxxxxxxxxxxxx
- Date: Wed, 2 Mar 2005 13:35:07 -0800
On Thu, Mar 03, 2005 at 10:22:24AM +1300, Jeff McClintock wrote:
> You can in general use non-virtual methods. Don't think it's considered
> good practice though.
> usually better to construct a new CFoo using Foo to initialise it.
So, for GUIDs this is not very expesive or very common, so it's OK. I'm
just wondering if the same problem will come up again later.
I don't think it will. The difference between GUIDs and every other
struct (or almost every) is that the host might pass a plugin a GUID
struct that the plugin did not originally create. Almost everything
else will be objects created by the plugin and passed to the host and
back.
> i take it we're talking about GUIDs, and the need for operator== and
> operator<.
>
> Might be easier to have no wrapper class at all, but to simply define
> non-member functions for comparison and equality. That would allow you
> to use struct GMPI_GUID in a STL map, without any modification to the
> struct.
Looking at the map docs, that seems possible. Is it cleaner? The
compiler can automagically create a CFoo from a Foo with the appropriate
help (constructor). In this case it's cheap and I don't think it will
bite us in the butt.
> Jeff
>
> Tim Hockin wrote:
> >On Thu, Mar 03, 2005 at 10:01:09AM +1300, Jeff McClintock wrote:
> >
> >>>OK, so second question. If I cast a "struct Foo *" to a "class CFoo *",
> >>>what happens? Can I use non-virtual methods on it? Can I use virtual
> >>>methods on it?
> >>>
> >>>Obviously, I could not access any data members that are part of CFoo but
> >>>not Foo, right?
> >>
> >>Well no. Since CFoo inherits from Foo, a pointer to CFoo can access Foo
> >>members (provided they're public of course).
> >
> >
> >Re-read what I wrote :) A CFoo that came from a Foo can access Foo
> >members but not CFoo members.
> >
> >----------------------------------------------------------------------
> >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: http://www.freelists.org/archives/gmpi
> >Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe
> >
> >
>
>
> ----------------------------------------------------------------------
> 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: http://www.freelists.org/archives/gmpi
> Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe
>
----------------------------------------------------------------------
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: http://www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe
- References:
- [gmpi] C++ detail question
- From: Tim Hockin
- [gmpi] Re: C++ detail question
- From: Paul Davis
- [gmpi] Re: C++ detail question
- From: Tim Hockin
- [gmpi] Re: C++ detail question
- From: Jeff McClintock
- [gmpi] Re: C++ detail question
- From: Tim Hockin
- [gmpi] Re: C++ detail question
- From: Jeff McClintock
Other related posts:
- » [gmpi] C++ detail question
- » [gmpi] Re: C++ detail question
- » [gmpi] Re: C++ detail question
- » [gmpi] Re: C++ detail question
- » [gmpi] Re: C++ detail question
- » [gmpi] Re: C++ detail question
- » [gmpi] Re: C++ detail question
- » [gmpi] Re: C++ detail question
- » [gmpi] Re: C++ detail question
- » [gmpi] Re: C++ detail question
- » [gmpi] Re: C++ detail question
- » [gmpi] Re: C++ detail question
- » [gmpi] Re: C++ detail question
- [gmpi] C++ detail question
- From: Tim Hockin
- [gmpi] Re: C++ detail question
- From: Paul Davis
- [gmpi] Re: C++ detail question
- From: Tim Hockin
- [gmpi] Re: C++ detail question
- From: Jeff McClintock
- [gmpi] Re: C++ detail question
- From: Tim Hockin
- [gmpi] Re: C++ detail question
- From: Jeff McClintock