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, ...)

 > 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.

Unless C++ can figure out at compile time *exactly* which class is being invoked, I think... It's hard to know.


Anyway, I don't think Jose really wanted a virtual member here, as he definitely seems to want the only usage of these functions to be expanded inline, right? If so, the virtual keyword is unneccessary -- isn't it?

Keith



-------------------------------------------------------
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