http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

strange C++ abnomality........



--- Sponsor's Message --------------------------------------
Discuss Tech News as It Happens!
Keep up with the latest happenings in high tech -- FREE!
http://click.topica.com/aaaa4IbUrGczbU68iFb/technology
------------------------------------------------------------
  Hello,
 
  Hopefully. someone will be able to correct me on this, but I belive that I've run into a rather perculiar limitation in ANSI compilant C++ compilers.
Consider the following example:
 
class CTriangleRenderer
{
   public:
      // blah blah...
      char * RenderVisibleSet(CPolygon**);
      char * MMX_RenderVisibleSet(CPolygon**);
      char *(*CB_RenderSet)(CPolygon**);
     // blah blah, and so forth
   private:
      void SwapRenderers(void);
     // blah blah.
 };
 
Now,humor me for a but a moment longer. Let us suppose that the rendering function used is dependant on the build version version of the project.
If the version of pre-release than 'RenderVisibleSet' is used -- else 'MMX_RenderVisibleSet' is used. In the constructor, assume the following lines are
present:
 
#ifdef __DEBUG_VERSION__
SwapRenderers();
#endif
 
and CTriangleRenderer::SwapRenderers is defined as:
{
#ifdef __DEBUG_VERSION__
 CB_RenderSet = CTriangleSet::RenderVisibleSet;
#else
 CB_RenderSet = CTriangleSet::MMX_RenderVisibleSet;
#endif
}
 
For some reason, this is illegal. You can't assign methods pointers to callbacks which reside within the class in question. I've been messing around with hacks to trying to get
it to work ( mainly casting / tweaking of compiler options ). I hope it is something that I am just overlooking, as that seems a rather... foolish limitation.
 
I hope someone can help;
Thanks in advance,
Josiah.
  
 
 
 
     
____________________________________________________________
T O P I C A  -- Learn More. Surf Less.
Newsletters, Tips and Discussions on Topics You Choose.
http://www.topica.com/partner/tag01