On Mon, Mar 10, 2003 at 11:59:05PM +0000, Keith Whitwell wrote:
> 
> Unless C++ can figure out at compile time *exactly* which class is being 
> invoked, I think...  It's hard to know.

It can, with templates.

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

Yes, when using templates they become sort of unecessary. These are the
two main C++ paradigms for generic programming:
 - virtualization: generic algorithms operate on abstract classes using
   their virtual methods. (no inlining on the virtual methods is
   possible because the compiler doesn't know which function is calling
   until run-time)
 - templates: generic algorithms are instantiated for each classes,
   using their methods (inlining of the methods is possible, becuase the
   compiler knows the function in compile time)

So far I've been following more the first paradigm (hence the virtual
keyword in everything), which matches more closely the current C code
and OOP principles in general, but it's becoming clearer that for the 3D
driver, it will be necessary the second paradigm to avoid the C++
overheads.

Still, there is no harm in leaving those virtual keywords and give/make
an choice of paradigms later. These two paradigms don't exactly match,
but you can interchange/mix them to get a good compromise.

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