On Tue, Mar 11, 2003 at 12:42:26AM +0100, Marcelo E. Magallon wrote:
> On Mon, Mar 10, 2003 at 10:23:07PM +0000, José Fonseca wrote:
> 
>  > struct function_table {
>  >   ...
>  >   void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
>  >   ...
>  > } driver;
>  > 
>  > and
>  > 
>  > class Context {
>  >   ...
>  >   void BlendFunc(GLenum sfactor, GLenum dfactor);
>  >   ...
>  > } ;
>  > 
>  > You can't simply do
>  > 
>  >   driver.BlendFunc = Context::BlendFunc;
> 
>  No, you can't do that.  The problem is not the rhs as you seem to think
>  but the lhs.  The rhs needs to be &Context::BlendFunc.  What type does
>  that have?  void (Context::*BlendFunc)(GLcontext *ctx, ...)

I know that sintatically that isn't allowed, but with a cast, and an
appropriate ABI, may it could, but it would be very bad practice and
we'd regret later.

>  > As I said above this can be done in C++, and without damage to
>  > efficiency.
> 
>  I doubt that.  (JFTR, if I'm given the choice of programming in C++ or
>  C, I'll pick C++.  I'm really not being a C zealot)
> 
>  > class TNL {
>  >   // A OpenGL function
>  >   virtual void Coord3f(GLfloat x, GLfloat y, GLfloat z) = 0;
> 
>      ^^^^^^^
>      pure virtual method.  Depending on what you want to do with this,
>      this will incur in a function call overhead, inline or not.

See
http://www.parashift.com/c++-faq-lite/value-vs-ref-semantics.html#faq-31.6
.  It will incur in a function call overhead only if it's a
pointer/reference to an abstract class. If using a template for the
callback function then that won't happen. Of course that this behavior
is compiler dependent and has to be checked in gcc.

José Fonseca
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to